tx1 encode h264 ,then use ffmpeg or easyrtmp encode to flv and use rtmp send to aliyun but cannot pl...

we use tx1 to hard encod ,the use ffmpeg push rtmp to aliyun ,but web video player cannot play. i analyse the saved raw
h264 file use h264visa, i found the sps and pps of h264 lost some iterms compared to standard h264 raw data.

Hi Allen,
Please check if the post helps:
https://devtalk.nvidia.com/default/topic/992525/jetson-tx1/no-video-for-hls-on-ios/post/5084851/#5084851

If it still fails, please share what items are lost in sps/pps.

Hi, DaneLLL

Thanks for your reply.

My case:
We are using low level api(tegra_media_api) to get frame from camera in runtime. then feed it to hardware video converter by creating a NvVideoEncoder::createVideoEncoder(“enc0”), we get every frame from encoder_capture_plane_dq_callback func then pushed it to outside web server by rtmp.

  1. when we try to play the H264 stream from outside web using flash, we get erro in playing…
  2. the H264 encoder works fine. we checked the saved stream by decoding using another sample and rendering it to display. it works fine.
  3. if we use ffmpeg to push the h264 video to outside web, we can play it correctly.
  4. if we play the saved h264 stream by local video player like VLC, it works fine.
  5. If we using gstream to push the video outside, it works fine. the video can be displayed on outside web.

Below is the capture about the information displayed by H264VISA, we found there are something missing in the frame got from encoder_capture_plane_dq_callback。

So, how could we get a standard h264 frame which could be played correctly on outside web flash player in such case?

Note: we want to do some changes in every frame, then feed it to video encoder by nvbuffer. after that pushed to outside in runtime. that’s why we don’t use gstream. any confuse let me know. I can’t find any related information to sovle my problem.

Hi Allen,
Somehow I am not able to access the image. Could you attach the good and ng h264 stream for reference?

Hi, AaneLLL

I attached the tools to compare the video and the video captured from video encoder.
https://we.tl/QFpj0twmWl

And also I found there is already a topic about the same issue.
https://devtalk.nvidia.com/default/topic/951298/jetson-tx1/using-video-from-a-h264-live-stream/

Hi Allen,
We are checking to add the functionality of inserting VUI to MM APIs in next release.

Hi, AaneLLL,

 Then when will you publish next release version? Could you give us a concrete time so we can adjust our developing  plan?

Hi Allen,

I have also encountered the same problem at TX2. The H.264 High Profile stream from TX2 encoder cannot play by Flash player, but main profile is OK,
As far as I know, the Flash player can support H.264 High Profile. Then I analyzed the h264 raw by h264visa(Allen provided), I find the main profile is also miss the VUI, that means the fail is not caused by the missing of VUI. I also found a bit unusual, the “reserved_zero_4bit” is 12, but the main profile and standard_H264.h264(Allen provided) is 0. It must be 0?

Hi DaneLLL,

Please give me some advice. Thanks!
Do I need to publish it in the TX2 discussion board?

Hi all,

I have found the key for this issue. The key is “reserved_zero_4bit” must be 0. I modify it at outside, then the high profile stream can be played by the Flash Player.

Hi DaneLLL,

Can you fix this issue? Thank you.

Hi zcs,
I see reserved_zero_2bits in decoding via JM decoder 19.0:

Annex B NALU w/ long startcode, len 12, forbidden_bit 0, nal_reference_idc 3, nal_unit_type 7

@0     SPS: profile_idc                                       01100100 (100) 
@8     SPS: constrained_set0_flag                                    0 (  0) 
@9     SPS: constrained_set1_flag                                    0 (  0) 
@10    SPS: constrained_set2_flag                                    0 (  0) 
@11    SPS: constrained_set3_flag                                    0 (  0) 
@12    SPS: constrained_set4_flag                                    0 (  0) 
@13    SPS: constrained_set5_flag                                    0 (  0) 
@14    SPS: reserved_zero_2bits                                     00 (  0) 
@16    SPS: level_idc                                         00110100 ( 52) 
@24    SPS: seq_parameter_set_id                                     1 (  0) 
@25    SPS: chroma_format_idc                                      010 (  1) 
@28    SPS: bit_depth_luma_minus8                                    1 (  0) 
@29    SPS: bit_depth_chroma_minus8                                  1 (  0) 
@30    SPS: lossless_qpprime_y_zero_flag                             0 (  0) 
@31    SPS: seq_scaling_matrix_present_flag                          0 (  0) 
@32    SPS: log2_max_frame_num_minus4                            00101 (  4) 
@37    SPS: pic_order_cnt_type                                     011 (  2) 
@40    SPS: num_ref_frames                                         010 (  1) 
@43    SPS: gaps_in_frame_num_value_allowed_flag                     0 (  0) 
@44    SPS: pic_width_in_mbs_minus1                      0000001111000 (119) 
@57    SPS: pic_height_in_map_units_minus1               0000001000100 ( 67) 
@70    SPS: frame_mbs_only_flag                                      1 (  1) 
@71    SPS: direct_8x8_inference_flag                                1 (  1) 
@72    SPS: frame_cropping_flag                                      1 (  1) 
@73    SPS: frame_crop_left_offset                                   1 (  0) 
@74    SPS: frame_crop_right_offset                                  1 (  0) 
@75    SPS: frame_crop_top_offset                                    1 (  0) 
@76    SPS: frame_crop_bottom_offset                             00101 (  4) 
@81    SPS: vui_parameters_present_flag                              0 (  0)

I think h264 spec is updated to adopt some new features. Sorry that we cannot revert SW/FW to output stream in old spec. Please do it in your application.

Hi DaneLLL,

Thanks for your reply.

Hi, zcs

Thanks for your information.

Could u share your modification about the frame?

I tried to changed the reserved_zero_4bit from 12 to 0 with both profile(main and high). I still can get it diplayed on the flash player.

“reserved_zero_4bit” bit locates at the third byte of SPS.

I tried on TX1.

Hi DaneLLL
about this problem , I found that Nvencoder capture picture through V4l2,the pixel formet is V4L2_PIX_FMT_YUV420M,which is a multi plane pixel format, so flash player may support just V4L2_PIX_FMT_YUV420 which is single plane pixel format. Could you tell me how to transer V4L2_PIX_FMT_YUV420M to V4L2_PIX_FMT_YUV420. or You can supply a API to set such configuration, or You can add the support in next release version. 3Q

Hi Allen,
V4L2_PIX_FMT_YUV420M and V4L2_PIX_FMT_YUV420 are identical. It is the way of putting Y U V in one contiguous memory section or in three memory sections. Is makes no difference to encoded h264 stream.

Please try what @zcs suggests, or wait for next release of adding inserting VUI.