hbiyik / FFmpeg

PLEASE USE https://github.com/nyanmisaka/ffmpeg-rockchip REPO INSTEAD.
https://github.com/nyanmisaka/ffmpeg-rockchip
Other
90 stars 7 forks source link

Encoding raw NV12 from MIPI camera #22

Closed avafinger closed 10 months ago

avafinger commented 10 months ago

If you have a MIPI camera you can try to encode NV12 1920x1080 and you get the wrong FPS and the encoded result cannot be played.

command line: ffmpeg -f v4l2 -pixel_format nv12 -framerate 30 -video_size 1920x1080 -i /dev/video11 out3.h264

you get:

[video4linux2,v4l2 @ 0x5568763b90] ioctl(VIDIOC_G_INPUT): Inappropriate ioctl for device [video4linux2,v4l2 @ 0x5568763b90] ioctl(VIDIOC_G_PARM): Inappropriate ioctl for device, using framerate 30/1 Input #0, video4linux2,v4l2, from '/dev/video11': Duration: N/A, start: 235171.186780, bitrate: 829 kb/s Stream #0:0: Video: rawvideo (NV12 / 0x3231564E), nv12, 1920x1080, 829 kb/s, 0.03 fps, 0.03 tbr, 1000k tbn

the result cannot be played:

Input #0, h264, from 'out3.h264':  0KB vq=    0KB sq=    0B f=0/0   
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: h264 (High), yuv420p(progressive), 1920x1080, 0.03 fps, 0.03 tbr, 1200k tbn
[h264_rkmpp_decoder @ 0x7f6c8b5140] Picture format is yuv420p.
[h264_rkmpp_decoder @ 0x7f6c8b5140] Decoder noticed an info change  
rga_api version 1.8.1_[5]

If you let ffmpeg calculate the FPS and bitrate for 1920x1080 it gets weird values but gets it right for 640x480.

`

avafinger commented 10 months ago

Attaching -debug_ts we get:

ffmpeg -f v4l2 -pixel_format nv12 -framerate 30 -video_size 640x480 -i /dev/video11 -y out3.h264 -debug_ts

demuxer -> ist_index:0:0 type:video pkt_pts:236923623183 pkt_pts_time:236924 pkt_dts:236923623183 pkt_dts_time:236924 duration:30000000 duration_time:30
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:0 pkt_pts_time:0 pkt_dts:0 pkt_dts_time:0 duration:30000000 duration_time:30 off:-236923623183 off_time:-236924
decoder -> ist_index:0 type:video frame_pts:0 frame_pts_time:0 best_effort_ts:0 best_effort_ts_time:0 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:0 pts_time:0 time_base:1/1000000
[h264_rkmpp_encoder @ 0x55a0b6f770] Picture format is nv12.
[h264_rkmpp_encoder @ 0x55a0b6f770] Rate Control mode is set to CBR
[h264_rkmpp_encoder @ 0x55a0b6f770] Bitrate Target/Min/Max is set to 6000000/5625000/6375000
[h264_rkmpp_encoder @ 0x55a0b6f770] Profile is set to HIGH
[h264_rkmpp_encoder @ 0x55a0b6f770] 8x8 Transform is enabled
[h264_rkmpp_encoder @ 0x55a0b6f770] Level is set to 0
[h264_rkmpp_encoder @ 0x55a0b6f770] Coder is set to CABAC
[h264_rkmpp_encoder @ 0x55a0b6f770] Quality Min/Max is set to 50%(Quant=30) / 100%(Quant=10)
Output #0, h264, to 'out3.h264':
  Metadata:
    encoder         : Lavf60.3.100
  Stream #0:0: Video: h264 (High), nv12(progressive), 640x480, q=2-31, 6000 kb/s, 0.03 fps, 0.03 tbn
    Metadata:
      encoder         : Lavc60.3.100 h264_rkmpp_encoder
filter -> pts:0 pts_time:0 exact:-0.000008 time_base:30/1
[vost#0:0/h264_rkmpp_encoder @ 0x55a0b6f460] encoder <- type:video frame_pts:0 frame_pts_time:0 time_base:30/1
[h264_rkmpp_encoder @ 0x55a0b6f770] Reconfigured with w=640, h=480, format=nv12.
[vost#0:0/h264_rkmpp_encoder @ 0x55a0b6f460] encoder -> type:video pkt_pts:0 pkt_pts_time:0 pkt_dts:0 pkt_dts_time:0 duration:0 duration_time:0
    Last message repeated 1 times
frame=    0 fps=0.0 q=-0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=N/[vost#0:0/h264_rkmpp_encoder @ 0x55a0b6f460] muxer <- type:video pkt_pts:0 pkt_pts_time:0 pkt_dts:0 pkt_dts_time:0 duration:1 duration_time:30 size:91866
demuxer -> ist_index:0:0 type:video pkt_pts:236923656516 pkt_pts_time:236924 pkt_dts:236923656516 pkt_dts_time:236924 duration:30000000 duration_time:30
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:33333 pkt_pts_time:0.033333 pkt_dts:33333 pkt_dts_time:0.033333 duration:30000000 duration_time:30 off:-236923623183 off_time:-236924
decoder -> ist_index:0 type:video frame_pts:33333 frame_pts_time:0.033333 best_effort_ts:33333 best_effort_ts_time:0.033333 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:33333 pts_time:0.033333 time_base:1/1000000
filter -> pts:0 pts_time:0 exact:0.001122 time_base:30/1
[vost#0:0/h264_rkmpp_encoder @ 0x55a0b6f460] encoder <- type:video frame_pts:1 frame_pts_time:30 time_base:30/1
[vost#0:0/h264_rkmpp_encoder @ 0x55a0b6f460] encoder -> type:video pkt_pts:1 pkt_pts_time:30 pkt_dts:1 pkt_dts_time:30 duration:0 duration_time:0
    Last message repeated 1 times
[vost#0:0/h264_rkmpp_encoder @ 0x55a0b6f460] muxer <- type:video pkt_pts:1 pkt_pts_time:30 pkt_dts:1 pkt_dts_time:30 duration:1 duration_time:30 size:65530
demuxer -> ist_index:0:0 type:video pkt_pts:236923689916 pkt_pts_time:236924 pkt_dts:236923689916 pkt_dts_time:236924 duration:30000000 duration_time:30
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:66733 pkt_pts_time:0.066733 pkt_dts:66733 pkt_dts_time:0.066733 duration:30000000 duration_time:30 off:-236923623183 off_time:-236924
decoder -> ist_index:0 type:video frame_pts:66733 frame_pts_time:0.066733 best_effort_ts:66733 best_effort_ts_time:0.066733 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:66733 pts_time:0.066733 time_base:1/1000000
filter -> pts:0 pts_time:0 exact:0.002235 time_base:30/1
[vost#0:0/h264_rkmpp_encoder @ 0x55a0b6f460] encoder <- type:video frame_pts:2 frame_pts_time:60 time_base:30/1
[vost#0:0/h264_rkmpp_encoder @ 0x55a0b6f460] encoder -> type:video pkt_pts:2 pkt_pts_time:60 pkt_dts:2 pkt_dts_time:60 duration:0 duration_time:0
    Last message repeated 1 times
[vost#0:0/h264_rkmpp_encoder @ 0x55a0b6f460] muxer <- type:video pkt_pts:2 pkt_pts_time:60 pkt_dts:2 pkt_dts_time:60 duration:1 duration_time:30 size:60563
demuxer -> ist_index:0:0 type:video pkt_pts:236923723245 pkt_pts_time:236924 pkt_dts:236923723245 pkt_dts_time:236924 duration:30000000 duration_time:30
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:100062 pkt_pts_time:0.100062 pkt_dts:100062 pkt_dts_time:0.100062 duration:30000000 duration_time:30 off:-236923623183 off_time:-236924
decoder -> ist_index:0 type:video frame_pts:100062 frame_pts_time:0.100062 best_effort_ts:100062 best_effort_ts_time:0.100062 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:100062 pts_time:0.100062 time_base:1/1000000
filter -> pts:0 pts_time:0 exact:0.003349 time_base:30/1
demuxer -> ist_index:0:0 type:video pkt_pts:236923756576 pkt_pts_time:236924 pkt_dts:236923756576 pkt_dts_time:236924 duration:30000000 duration_time:30
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:133393 pkt_pts_time:0.133393 pkt_dts:133393 pkt_dts_time:0.133393 duration:30000000 duration_time:30 off:-236923623183 off_time:-236924
decoder -> ist_index:0 type:video frame_pts:133393 frame_pts_time:0.133393 best_effort_ts:133393 best_effort_ts_time:0.133393 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:133393 pts_time:0.133393 time_base:1/1000000
filter -> pts:0 pts_time:0 exact:0.004448 time_base:30/1
demuxer -> ist_index:0:0 type:video pkt_pts:236923789906 pkt_pts_time:236924 pkt_dts:236923789906 pkt_dts_time:236924 duration:30000000 duration_time:30
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:166723 pkt_pts_time:0.166723 pkt_dts:166723 pkt_dts_time:0.166723 duration:30000000 duration_time:30 off:-236923623183 off_time:-236924
decoder -> ist_index:0 type:video frame_pts:166723 frame_pts_time:0.166723 best_effort_ts:166723 best_effort_ts_time:0.166723 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:166723 pts_time:0.166723 time_base:1/1000000
filter -> pts:0 pts_time:0 exact:0.005562 time_base:30/1
demuxer -> ist_index:0:0 type:video pkt_pts:236923823177 pkt_pts_time:236924 pkt_dts:236923823177 pkt_dts_time:236924 duration:30000000 duration_time:30
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:199994 pkt_pts_time:0.199994 pkt_dts:199994 pkt_dts_time:0.199994 duration:30000000 duration_time:30 off:-236923623183 off_time:-236924
decoder -> ist_index:0 type:video frame_pts:199994 frame_pts_time:0.199994 best_effort_ts:199994 best_effort_ts_time:0.199994 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:199994 pts_time:0.199994 time_base:1/1000000
filter -> pts:0 pts_time:0 exact:0.006676 time_base:30/1
demuxer -> ist_index:0:0 type:video pkt_pts:236923856568 pkt_pts_time:236924 pkt_dts:236923856568 pkt_dts_time:236924 duration:30000000 duration_time:30
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:233385 pkt_pts_time:0.233385 pkt_dts:233385 pkt_dts_time:0.233385 duration:30000000 duration_time:30 off:-236923623183 off_time:-236924
decoder -> ist_index:0 type:video frame_pts:233385 frame_pts_time:0.233385 best_effort_ts:233385 best_effort_ts_time:0.233385 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:233385 pts_time:0.233385 time_base:1/1000000
filter -> pts:0 pts_time:0 exact:0.007790 time_base:30/1
demuxer -> ist_index:0:0 type:video pkt_pts:236923889842 pkt_pts_time:236924 pkt_dts:236923889842 pkt_dts_time:236924 duration:30000000 duration_time:30
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:266659 pkt_pts_time:0.266659 pkt_dts:266659 pkt_dts_time:0.266659 duration:30000000 duration_time:30 off:-236923623183 off_time:-236924
decoder -> ist_index:0 type:video frame_pts:266659 frame_pts_time:0.266659 best_effort_ts:266659 best_effort_ts_time:0.266659 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:266659 pts_time:0.266659 time_base:1/1000000
filter -> pts:0 pts_time:0 exact:0.008904 time_base:30/1
demuxer -> ist_index:0:0 type:video pkt_pts:236923923232 pkt_pts_time:236924 pkt_dts:236923923232 pkt_dts_time:236924 duration:30000000 duration_time:30
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:300049 pkt_pts_time:0.300049 pkt_dts:300049 pkt_dts_time:0.300049 duration:30000000 duration_time:30 off:-236923623183 off_time:-236924
decoder -> ist_index:0 type:video frame_pts:300049 frame_pts_time:0.300049 best_effort_ts:300049 best_effort_ts_time:0.300049 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:300049 pts_time:0.300049 time_base:1/1000000
filter -> pts:0 pts_time:0 exact:0.010002 time_base:30/1
demuxer -> ist_index:0:0 type:video pkt_pts:236923956564 pkt_pts_time:236924 pkt_dts:236923956564 pkt_dts_time:236924 duration:30000000 duration_time:30
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:333381 pkt_pts_time:0.333381 pkt_dts:333381 pkt_dts_time:0.333381 duration:30000000 duration_time:30 off:-236923623183 off_time:-236924

If we let ffmpeg calc FPS and bitrate for 640x480 is fine, but wrong if 1920x1080;

demuxer -> ist_index:0:0 type:video pkt_pts:237186785210 pkt_pts_time:237187 pkt_dts:237186785210 pkt_dts_time:237187 duration:0 duration_time:0
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:0 pkt_pts_time:0 pkt_dts:0 pkt_dts_time:0 duration:0 duration_time:0 off:-237186785210 off_time:-237187
decoder -> ist_index:0 type:video frame_pts:0 frame_pts_time:0 best_effort_ts:0 best_effort_ts_time:0 keyframe:1 frame_type:1 time_base:1/1000000
demuxer -> ist_index:0:0 type:video pkt_pts:237186818601 pkt_pts_time:237187 pkt_dts:237186818601 pkt_dts_time:237187 duration:0 duration_time:0
demuxer -> ist_index:0:0 type:video pkt_pts:237186851974 pkt_pts_time:237187 pkt_dts:237186851974 pkt_dts_time:237187 duration:0 duration_time:0
filter_raw -> pts:0 pts_time:0 time_base:1/1000000
[h264_rkmpp_encoder @ 0x5597d3e830] Picture format is nv12.
[h264_rkmpp_encoder @ 0x5597d3e830] Rate Control mode is set to CBR
[h264_rkmpp_encoder @ 0x5597d3e830] Bitrate Target/Min/Max is set to 6000000/5625000/6375000
[h264_rkmpp_encoder @ 0x5597d3e830] Profile is set to HIGH
[h264_rkmpp_encoder @ 0x5597d3e830] 8x8 Transform is enabled
[h264_rkmpp_encoder @ 0x5597d3e830] Level is set to 0
[h264_rkmpp_encoder @ 0x5597d3e830] Coder is set to CABAC
[h264_rkmpp_encoder @ 0x5597d3e830] Quality Min/Max is set to 50%(Quant=30) / 100%(Quant=10)
Output #0, h264, to 'out3.h264':
  Metadata:
    encoder         : Lavf60.3.100
  Stream #0:0: Video: h264 (High), nv12(progressive), 640x480, q=2-31, 6000 kb/s, 30 fps, 30 tbn
    Metadata:
      encoder         : Lavc60.3.100 h264_rkmpp_encoder
filter -> pts:0 pts_time:0 exact:-0.000008 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:0 frame_pts_time:0 time_base:1/30
[h264_rkmpp_encoder @ 0x5597d3e830] Reconfigured with w=640, h=480, format=nv12.
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:0 pkt_pts_time:0 pkt_dts:0 pkt_dts_time:0 duration:0 duration_time:0
    Last message repeated 1 times
frame=    0 fps=0.0 q=-0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=N/demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:33391 pkt_pts_time:0.033391 pkt_dts:33391 pkt_dts_time:0.033391 duration:0 duration_time:0 off:-237186785210 off_time:-237187
decoder -> ist_index:0 type:video frame_pts:33391 frame_pts_time:0.033391 best_effort_ts:33391 best_effort_ts_time:0.033391 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:33391 pts_time:0.033391 time_base:1/1000000
filter -> pts:1 pts_time:0.0333333 exact:1.001732 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:1 frame_pts_time:0.0333333 time_base:1/30
demuxer -> ist_index:0:0 type:video pkt_pts:237186885208 pkt_pts_time:237187 pkt_dts:237186885208 pkt_dts_time:237187 duration:0 duration_time:0
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:0 pkt_pts_time:0 pkt_dts:0 pkt_dts_time:0 duration:1 duration_time:0.0333333 size:91595
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:1 pkt_pts_time:0.0333333 pkt_dts:1 pkt_dts_time:0.0333333 duration:0 duration_time:0
    Last message repeated 1 times
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:66764 pkt_pts_time:0.066764 pkt_dts:66764 pkt_dts_time:0.066764 duration:0 duration_time:0 off:-237186785210 off_time:-237187
demuxer -> ist_index:0:0 type:video pkt_pts:237186918540 pkt_pts_time:237187 pkt_dts:237186918540 pkt_dts_time:237187 duration:0 duration_time:0
decoder -> ist_index:0 type:video frame_pts:66764 frame_pts_time:0.066764 best_effort_ts:66764 best_effort_ts_time:0.066764 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:66764 pts_time:0.066764 time_base:1/1000000
filter -> pts:2 pts_time:0.0666667 exact:2.002922 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:2 frame_pts_time:0.0666667 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:1 pkt_pts_time:0.0333333 pkt_dts:1 pkt_dts_time:0.0333333 duration:1 duration_time:0.0333333 size:56171
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:2 pkt_pts_time:0.0666667 pkt_dts:2 pkt_dts_time:0.0666667 duration:0 duration_time:0
    Last message repeated 1 times
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:99998 pkt_pts_time:0.099998 pkt_dts:99998 pkt_dts_time:0.099998 duration:0 duration_time:0 off:-237186785210 off_time:-237187
demuxer -> ist_index:0:0 type:video pkt_pts:237186951872 pkt_pts_time:237187 pkt_dts:237186951872 pkt_dts_time:237187 duration:0 duration_time:0
decoder -> ist_index:0 type:video frame_pts:99998 frame_pts_time:0.099998 best_effort_ts:99998 best_effort_ts_time:0.099998 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:99998 pts_time:0.099998 time_base:1/1000000
filter -> pts:3 pts_time:0.1 exact:2.999947 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:3 frame_pts_time:0.1 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:2 pkt_pts_time:0.0666667 pkt_dts:2 pkt_dts_time:0.0666667 duration:1 duration_time:0.0333333 size:29621
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:3 pkt_pts_time:0.1 pkt_dts:3 pkt_dts_time:0.1 duration:0 duration_time:0
    Last message repeated 1 times
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:133330 pkt_pts_time:0.13333 pkt_dts:133330 pkt_dts_time:0.13333 duration:0 duration_time:0 off:-237186785210 off_time:-237187
demuxer -> ist_index:0:0 type:video pkt_pts:237186985259 pkt_pts_time:237187 pkt_dts:237186985259 pkt_dts_time:237187 duration:0 duration_time:0
decoder -> ist_index:0 type:video frame_pts:133330 frame_pts_time:0.13333 best_effort_ts:133330 best_effort_ts_time:0.13333 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:133330 pts_time:0.13333 time_base:1/1000000
filter -> pts:4 pts_time:0.133333 exact:3.999901 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:4 frame_pts_time:0.133333 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:3 pkt_pts_time:0.1 pkt_dts:3 pkt_dts_time:0.1 duration:1 duration_time:0.0333333 size:30279
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:4 pkt_pts_time:0.133333 pkt_dts:4 pkt_dts_time:0.133333 duration:0 duration_time:0
    Last message repeated 1 times
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:166662 pkt_pts_time:0.166662 pkt_dts:166662 pkt_dts_time:0.166662 duration:0 duration_time:0 off:-237186785210 off_time:-237187
demuxer -> ist_index:0:0 type:video pkt_pts:237187018601 pkt_pts_time:237187 pkt_dts:237187018601 pkt_dts_time:237187 duration:0 duration_time:0
decoder -> ist_index:0 type:video frame_pts:166662 frame_pts_time:0.166662 best_effort_ts:166662 best_effort_ts_time:0.166662 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:166662 pts_time:0.166662 time_base:1/1000000
filter -> pts:5 pts_time:0.166667 exact:4.999870 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:5 frame_pts_time:0.166667 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:4 pkt_pts_time:0.133333 pkt_dts:4 pkt_dts_time:0.133333 duration:1 duration_time:0.0333333 size:26291
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:5 pkt_pts_time:0.166667 pkt_dts:5 pkt_dts_time:0.166667 duration:0 duration_time:0
    Last message repeated 1 times
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:200049 pkt_pts_time:0.200049 pkt_dts:200049 pkt_dts_time:0.200049 duration:0 duration_time:0 off:-237186785210 off_time:-237187
demuxer -> ist_index:0:0 type:video pkt_pts:237187051869 pkt_pts_time:237187 pkt_dts:237187051869 pkt_dts_time:237187 duration:0 duration_time:0
decoder -> ist_index:0 type:video frame_pts:200049 frame_pts_time:0.200049 best_effort_ts:200049 best_effort_ts_time:0.200049 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:200049 pts_time:0.200049 time_base:1/1000000
filter -> pts:6 pts_time:0.2 exact:6.001472 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:6 frame_pts_time:0.2 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:5 pkt_pts_time:0.166667 pkt_dts:5 pkt_dts_time:0.166667 duration:1 duration_time:0.0333333 size:25526
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:6 pkt_pts_time:0.2 pkt_dts:6 pkt_dts_time:0.2 duration:0 duration_time:0
    Last message repeated 1 times
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:233391 pkt_pts_time:0.233391 pkt_dts:233391 pkt_dts_time:0.233391 duration:0 duration_time:0 off:-237186785210 off_time:-237187
demuxer -> ist_index:0:0 type:video pkt_pts:237187085267 pkt_pts_time:237187 pkt_dts:237187085267 pkt_dts_time:237187 duration:0 duration_time:0
decoder -> ist_index:0 type:video frame_pts:233391 frame_pts_time:0.233391 best_effort_ts:233391 best_effort_ts_time:0.233391 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:233391 pts_time:0.233391 time_base:1/1000000
filter -> pts:7 pts_time:0.233333 exact:7.001732 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:7 frame_pts_time:0.233333 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:6 pkt_pts_time:0.2 pkt_dts:6 pkt_dts_time:0.2 duration:1 duration_time:0.0333333 size:25369
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:7 pkt_pts_time:0.233333 pkt_dts:7 pkt_dts_time:0.233333 duration:0 duration_time:0
    Last message repeated 1 times
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:266659 pkt_pts_time:0.266659 pkt_dts:266659 pkt_dts_time:0.266659 duration:0 duration_time:0 off:-237186785210 off_time:-237187
demuxer -> ist_index:0:0 type:video pkt_pts:237187118534 pkt_pts_time:237187 pkt_dts:237187118534 pkt_dts_time:237187 duration:0 duration_time:0
decoder -> ist_index:0 type:video frame_pts:266659 frame_pts_time:0.266659 best_effort_ts:266659 best_effort_ts_time:0.266659 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:266659 pts_time:0.266659 time_base:1/1000000
filter -> pts:8 pts_time:0.266667 exact:7.999779 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:8 frame_pts_time:0.266667 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:7 pkt_pts_time:0.233333 pkt_dts:7 pkt_dts_time:0.233333 duration:1 duration_time:0.0333333 size:24847
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:8 pkt_pts_time:0.266667 pkt_dts:8 pkt_dts_time:0.266667 duration:0 duration_time:0
    Last message repeated 1 times
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:300057 pkt_pts_time:0.300057 pkt_dts:300057 pkt_dts_time:0.300057 duration:0 duration_time:0 off:-237186785210 off_time:-237187
decoder -> ist_index:0 type:video frame_pts:300057 frame_pts_time:0.300057 best_effort_ts:300057 best_effort_ts_time:0.300057 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:300057 pts_time:0.300057 time_base:1/1000000
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:8 pkt_pts_time:0.266667 pkt_dts:8 pkt_dts_time:0.266667 duration:1 duration_time:0.0333333 size:24524
filter -> pts:9 pts_time:0.3 exact:9.001717 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:9 frame_pts_time:0.3 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:9 pkt_pts_time:0.3 pkt_dts:9 pkt_dts_time:0.3 duration:0 duration_time:0
    Last message repeated 1 times
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:333324 pkt_pts_time:0.333324 pkt_dts:333324 pkt_dts_time:0.333324 duration:0 duration_time:0 off:-237186785210 off_time:-237187
decoder -> ist_index:0 type:video frame_pts:333324 frame_pts_time:0.333324 best_effort_ts:333324 best_effort_ts_time:0.333324 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:333324 pts_time:0.333324 time_base:1/1000000
filter -> pts:10 pts_time:0.333333 exact:9.999733 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:10 frame_pts_time:0.333333 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:9 pkt_pts_time:0.3 pkt_dts:9 pkt_dts_time:0.3 duration:1 duration_time:0.0333333 size:25196
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:10 pkt_pts_time:0.333333 pkt_dts:10 pkt_dts_time:0.333333 duration:0 duration_time:0
    Last message repeated 1 times
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:10 pkt_pts_time:0.333333 pkt_dts:10 pkt_dts_time:0.333333 duration:1 duration_time:0.0333333 size:24144
demuxer -> ist_index:0:0 type:video pkt_pts:237187151871 pkt_pts_time:237187 pkt_dts:237187151871 pkt_dts_time:237187 duration:33333 duration_time:0.033333
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:366661 pkt_pts_time:0.366661 pkt_dts:366661 pkt_dts_time:0.366661 duration:33333 duration_time:0.033333 off:-237186785210 off_time:-237187
decoder -> ist_index:0 type:video frame_pts:366661 frame_pts_time:0.366661 best_effort_ts:366661 best_effort_ts_time:0.366661 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:366661 pts_time:0.366661 time_base:1/1000000
filter -> pts:11 pts_time:0.366667 exact:10.999840 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:11 frame_pts_time:0.366667 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:11 pkt_pts_time:0.366667 pkt_dts:11 pkt_dts_time:0.366667 duration:0 duration_time:0
    Last message repeated 1 times
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:11 pkt_pts_time:0.366667 pkt_dts:11 pkt_dts_time:0.366667 duration:1 duration_time:0.0333333 size:22744
demuxer -> ist_index:0:0 type:video pkt_pts:237187185201 pkt_pts_time:237187 pkt_dts:237187185201 pkt_dts_time:237187 duration:33333 duration_time:0.033333
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:399991 pkt_pts_time:0.399991 pkt_dts:399991 pkt_dts_time:0.399991 duration:33333 duration_time:0.033333 off:-237186785210 off_time:-237187
decoder -> ist_index:0 type:video frame_pts:399991 frame_pts_time:0.399991 best_effort_ts:399991 best_effort_ts_time:0.399991 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:399991 pts_time:0.399991 time_base:1/1000000
filter -> pts:12 pts_time:0.4 exact:11.999733 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:12 frame_pts_time:0.4 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:12 pkt_pts_time:0.4 pkt_dts:12 pkt_dts_time:0.4 duration:0 duration_time:0
    Last message repeated 1 times
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:12 pkt_pts_time:0.4 pkt_dts:12 pkt_dts_time:0.4 duration:1 duration_time:0.0333333 size:23209
demuxer -> ist_index:0:0 type:video pkt_pts:237187218533 pkt_pts_time:237187 pkt_dts:237187218533 pkt_dts_time:237187 duration:33333 duration_time:0.033333
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:433323 pkt_pts_time:0.433323 pkt_dts:433323 pkt_dts_time:0.433323 duration:33333 duration_time:0.033333 off:-237186785210 off_time:-237187
decoder -> ist_index:0 type:video frame_pts:433323 frame_pts_time:0.433323 best_effort_ts:433323 best_effort_ts_time:0.433323 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:433323 pts_time:0.433323 time_base:1/1000000
filter -> pts:13 pts_time:0.433333 exact:12.999702 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:13 frame_pts_time:0.433333 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:13 pkt_pts_time:0.433333 pkt_dts:13 pkt_dts_time:0.433333 duration:0 duration_time:0
    Last message repeated 1 times
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:13 pkt_pts_time:0.433333 pkt_dts:13 pkt_dts_time:0.433333 duration:1 duration_time:0.0333333 size:23144
demuxer -> ist_index:0:0 type:video pkt_pts:237187251865 pkt_pts_time:237187 pkt_dts:237187251865 pkt_dts_time:237187 duration:33333 duration_time:0.033333
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:466655 pkt_pts_time:0.466655 pkt_dts:466655 pkt_dts_time:0.466655 duration:33333 duration_time:0.033333 off:-237186785210 off_time:-237187
decoder -> ist_index:0 type:video frame_pts:466655 frame_pts_time:0.466655 best_effort_ts:466655 best_effort_ts_time:0.466655 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:466655 pts_time:0.466655 time_base:1/1000000
filter -> pts:14 pts_time:0.466667 exact:13.999657 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:14 frame_pts_time:0.466667 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:14 pkt_pts_time:0.466667 pkt_dts:14 pkt_dts_time:0.466667 duration:0 duration_time:0
    Last message repeated 1 times
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:14 pkt_pts_time:0.466667 pkt_dts:14 pkt_dts_time:0.466667 duration:1 duration_time:0.0333333 size:22763
demuxer -> ist_index:0:0 type:video pkt_pts:237187285259 pkt_pts_time:237187 pkt_dts:237187285259 pkt_dts_time:237187 duration:33333 duration_time:0.033333
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:500049 pkt_pts_time:0.500049 pkt_dts:500049 pkt_dts_time:0.500049 duration:33333 duration_time:0.033333 off:-237186785210 off_time:-237187
decoder -> ist_index:0 type:video frame_pts:500049 frame_pts_time:0.500049 best_effort_ts:500049 best_effort_ts_time:0.500049 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:500049 pts_time:0.500049 time_base:1/1000000
filter -> pts:15 pts_time:0.5 exact:15.001472 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:15 frame_pts_time:0.5 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:15 pkt_pts_time:0.5 pkt_dts:15 pkt_dts_time:0.5 duration:0 duration_time:0
    Last message repeated 1 times
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:15 pkt_pts_time:0.5 pkt_dts:15 pkt_dts_time:0.5 duration:1 duration_time:0.0333333 size:23310
demuxer -> ist_index:0:0 type:video pkt_pts:237187318529 pkt_pts_time:237187 pkt_dts:237187318529 pkt_dts_time:237187 duration:33333 duration_time:0.033333
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:533319 pkt_pts_time:0.533319 pkt_dts:533319 pkt_dts_time:0.533319 duration:33333 duration_time:0.033333 off:-237186785210 off_time:-237187
decoder -> ist_index:0 type:video frame_pts:533319 frame_pts_time:0.533319 best_effort_ts:533319 best_effort_ts_time:0.533319 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:533319 pts_time:0.533319 time_base:1/1000000
filter -> pts:16 pts_time:0.533333 exact:15.999580 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:16 frame_pts_time:0.533333 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:16 pkt_pts_time:0.533333 pkt_dts:16 pkt_dts_time:0.533333 duration:0 duration_time:0
    Last message repeated 1 times
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:16 pkt_pts_time:0.533333 pkt_dts:16 pkt_dts_time:0.533333 duration:1 duration_time:0.0333333 size:20921
demuxer -> ist_index:0:0 type:video pkt_pts:237187351923 pkt_pts_time:237187 pkt_dts:237187351923 pkt_dts_time:237187 duration:33333 duration_time:0.033333
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:566713 pkt_pts_time:0.566713 pkt_dts:566713 pkt_dts_time:0.566713 duration:33333 duration_time:0.033333 off:-237186785210 off_time:-237187
decoder -> ist_index:0 type:video frame_pts:566713 frame_pts_time:0.566713 best_effort_ts:566713 best_effort_ts_time:0.566713 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:566713 pts_time:0.566713 time_base:1/1000000
filter -> pts:17 pts_time:0.566667 exact:17.001396 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:17 frame_pts_time:0.566667 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:17 pkt_pts_time:0.566667 pkt_dts:17 pkt_dts_time:0.566667 duration:0 duration_time:0
    Last message repeated 1 times
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:17 pkt_pts_time:0.566667 pkt_dts:17 pkt_dts_time:0.566667 duration:1 duration_time:0.0333333 size:21489
demuxer -> ist_index:0:0 type:video pkt_pts:237187385255 pkt_pts_time:237187 pkt_dts:237187385255 pkt_dts_time:237187 duration:33333 duration_time:0.033333
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:600045 pkt_pts_time:0.600045 pkt_dts:600045 pkt_dts_time:0.600045 duration:33333 duration_time:0.033333 off:-237186785210 off_time:-237187
decoder -> ist_index:0 type:video frame_pts:600045 frame_pts_time:0.600045 best_effort_ts:600045 best_effort_ts_time:0.600045 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:600045 pts_time:0.600045 time_base:1/1000000
filter -> pts:18 pts_time:0.6 exact:18.001350 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:18 frame_pts_time:0.6 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:18 pkt_pts_time:0.6 pkt_dts:18 pkt_dts_time:0.6 duration:0 duration_time:0
    Last message repeated 1 times
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:18 pkt_pts_time:0.6 pkt_dts:18 pkt_dts_time:0.6 duration:1 duration_time:0.0333333 size:22558
demuxer -> ist_index:0:0 type:video pkt_pts:237187418587 pkt_pts_time:237187 pkt_dts:237187418587 pkt_dts_time:237187 duration:33333 duration_time:0.033333
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:633377 pkt_pts_time:0.633377 pkt_dts:633377 pkt_dts_time:0.633377 duration:33333 duration_time:0.033333 off:-237186785210 off_time:-237187
decoder -> ist_index:0 type:video frame_pts:633377 frame_pts_time:0.633377 best_effort_ts:633377 best_effort_ts_time:0.633377 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:633377 pts_time:0.633377 time_base:1/1000000
filter -> pts:19 pts_time:0.633333 exact:19.001320 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:19 frame_pts_time:0.633333 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:19 pkt_pts_time:0.633333 pkt_dts:19 pkt_dts_time:0.633333 duration:0 duration_time:0
    Last message repeated 1 times
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:19 pkt_pts_time:0.633333 pkt_dts:19 pkt_dts_time:0.633333 duration:1 duration_time:0.0333333 size:21995
demuxer -> ist_index:0:0 type:video pkt_pts:237187451859 pkt_pts_time:237187 pkt_dts:237187451859 pkt_dts_time:237187 duration:33333 duration_time:0.033333
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:666649 pkt_pts_time:0.666649 pkt_dts:666649 pkt_dts_time:0.666649 duration:33333 duration_time:0.033333 off:-237186785210 off_time:-237187
decoder -> ist_index:0 type:video frame_pts:666649 frame_pts_time:0.666649 best_effort_ts:666649 best_effort_ts_time:0.666649 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:666649 pts_time:0.666649 time_base:1/1000000
filter -> pts:20 pts_time:0.666667 exact:19.999474 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:20 frame_pts_time:0.666667 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:20 pkt_pts_time:0.666667 pkt_dts:20 pkt_dts_time:0.666667 duration:0 duration_time:0
    Last message repeated 1 times
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:20 pkt_pts_time:0.666667 pkt_dts:20 pkt_dts_time:0.666667 duration:1 duration_time:0.0333333 size:17142
demuxer -> ist_index:0:0 type:video pkt_pts:237187485192 pkt_pts_time:237187 pkt_dts:237187485192 pkt_dts_time:237187 duration:33333 duration_time:0.033333
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:699982 pkt_pts_time:0.699982 pkt_dts:699982 pkt_dts_time:0.699982 duration:33333 duration_time:0.033333 off:-237186785210 off_time:-237187
decoder -> ist_index:0 type:video frame_pts:699982 frame_pts_time:0.699982 best_effort_ts:699982 best_effort_ts_time:0.699982 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:699982 pts_time:0.699982 time_base:1/1000000
filter -> pts:21 pts_time:0.7 exact:20.999474 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:21 frame_pts_time:0.7 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:21 pkt_pts_time:0.7 pkt_dts:21 pkt_dts_time:0.7 duration:0 duration_time:0
    Last message repeated 1 times
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:21 pkt_pts_time:0.7 pkt_dts:21 pkt_dts_time:0.7 duration:1 duration_time:0.0333333 size:17671
demuxer -> ist_index:0:0 type:video pkt_pts:237187518583 pkt_pts_time:237188 pkt_dts:237187518583 pkt_dts_time:237188 duration:33333 duration_time:0.033333
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:733373 pkt_pts_time:0.733373 pkt_dts:733373 pkt_dts_time:0.733373 duration:33333 duration_time:0.033333 off:-237186785210 off_time:-237187
decoder -> ist_index:0 type:video frame_pts:733373 frame_pts_time:0.733373 best_effort_ts:733373 best_effort_ts_time:0.733373 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:733373 pts_time:0.733373 time_base:1/1000000
filter -> pts:22 pts_time:0.733333 exact:22.001198 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:22 frame_pts_time:0.733333 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:22 pkt_pts_time:0.733333 pkt_dts:22 pkt_dts_time:0.733333 duration:0 duration_time:0
    Last message repeated 1 times
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:22 pkt_pts_time:0.733333 pkt_dts:22 pkt_dts_time:0.733333 duration:1 duration_time:0.0333333 size:18149
demuxer -> ist_index:0:0 type:video pkt_pts:237187551916 pkt_pts_time:237188 pkt_dts:237187551916 pkt_dts_time:237188 duration:33333 duration_time:0.033333
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:766706 pkt_pts_time:0.766706 pkt_dts:766706 pkt_dts_time:0.766706 duration:33333 duration_time:0.033333 off:-237186785210 off_time:-237187
decoder -> ist_index:0 type:video frame_pts:766706 frame_pts_time:0.766706 best_effort_ts:766706 best_effort_ts_time:0.766706 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:766706 pts_time:0.766706 time_base:1/1000000
filter -> pts:23 pts_time:0.766667 exact:23.001183 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:23 frame_pts_time:0.766667 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:23 pkt_pts_time:0.766667 pkt_dts:23 pkt_dts_time:0.766667 duration:0 duration_time:0
    Last message repeated 1 times
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:23 pkt_pts_time:0.766667 pkt_dts:23 pkt_dts_time:0.766667 duration:1 duration_time:0.0333333 size:17570
demuxer -> ist_index:0:0 type:video pkt_pts:237187585248 pkt_pts_time:237188 pkt_dts:237187585248 pkt_dts_time:237188 duration:33333 duration_time:0.033333
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:800038 pkt_pts_time:0.800038 pkt_dts:800038 pkt_dts_time:0.800038 duration:33333 duration_time:0.033333 off:-237186785210 off_time:-237187
decoder -> ist_index:0 type:video frame_pts:800038 frame_pts_time:0.800038 best_effort_ts:800038 best_effort_ts_time:0.800038 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:800038 pts_time:0.800038 time_base:1/1000000
filter -> pts:24 pts_time:0.8 exact:24.001152 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:24 frame_pts_time:0.8 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:24 pkt_pts_time:0.8 pkt_dts:24 pkt_dts_time:0.8 duration:0 duration_time:0
    Last message repeated 1 times
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:24 pkt_pts_time:0.8 pkt_dts:24 pkt_dts_time:0.8 duration:1 duration_time:0.0333333 size:21987
demuxer -> ist_index:0:0 type:video pkt_pts:237187618521 pkt_pts_time:237188 pkt_dts:237187618521 pkt_dts_time:237188 duration:33333 duration_time:0.033333
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:833311 pkt_pts_time:0.833311 pkt_dts:833311 pkt_dts_time:0.833311 duration:33333 duration_time:0.033333 off:-237186785210 off_time:-237187
decoder -> ist_index:0 type:video frame_pts:833311 frame_pts_time:0.833311 best_effort_ts:833311 best_effort_ts_time:0.833311 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:833311 pts_time:0.833311 time_base:1/1000000
filter -> pts:25 pts_time:0.833333 exact:24.999336 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder <- type:video frame_pts:25 frame_pts_time:0.833333 time_base:1/30
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] encoder -> type:video pkt_pts:25 pkt_pts_time:0.833333 pkt_dts:25 pkt_dts_time:0.833333 duration:0 duration_time:0
    Last message repeated 1 times
[vost#0:0/h264_rkmpp_encoder @ 0x5597d3e520] muxer <- type:video pkt_pts:25 pkt_pts_time:0.833333 pkt_dts:25 pkt_dts_time:0.833333 duration:1 duration_time:0.0333333 size:16528
demuxer -> ist_index:0:0 type:video pkt_pts:237187651913 pkt_pts_time:237188 pkt_dts:237187651913 pkt_dts_time:237188 duration:33333 duration_time:0.033333
demuxer+ffmpeg -> ist_index:0:0 type:video pkt_pts:866703 pkt_pts_time:0.866703 pkt_dts:866703 pkt_dts_time:0.866703 duration:33333 duration_time:0.033333 off:-237186785210 off_time:-237187
decoder -> ist_index:0 type:video frame_pts:866703 frame_pts_time:0.866703 best_effort_ts:866703 best_effort_ts_time:0.866703 keyframe:1 frame_type:1 time_base:1/1000000
filter_raw -> pts:866703 pts_time:0.866703 time_base:1/1000000
filter -> pts:26 pts_time:0.866667 exact:26.001091 time_base:1/30
avafinger commented 10 months ago

@hbiyik

Fix: switch the numerator and denominator places here and above: https://github.com/hbiyik/FFmpeg/blob/encoder/libavdevice/v4l2.c#L875-L876

hbiyik commented 10 months ago

Great catch, but are you this the right way? https://www.kernel.org/doc/html/v4.8/media/uapi/v4l/vidioc-enumstd.html#v4l2-fract

Kernel v4l2 api states v4l2_fract (tpf variable in code) represents the period which is the inverse of frame rate. So nums and dens swapping seems the right choice at first look. May be rockchip kernel provides wrong data or sth else?

avafinger commented 10 months ago

Yeah, that breaks the v4l2 standard (webcam).

Here is the piece of code that works for both, webcam and mipi, only change that user-defined framerate portion.

    streamparm.type = BUF_TYPE_CAPTURE(s->use_mplane);
    if (v4l2_ioctl(s->fd, VIDIOC_G_PARM, &streamparm) < 0) {
#ifdef _OLD_CODE_       
        ret = AVERROR(errno);
        av_log(ctx, AV_LOG_WARNING, "ioctl(VIDIOC_G_PARM): %s\n", av_err2str(ret));
#else        
        struct v4l2_dv_timings timings;
        ret = AVERROR(errno);
        if (v4l2_ioctl(s->fd, VIDIOC_G_DV_TIMINGS, &timings) == 0) {
            const int total_width  = timings.bt.width  + timings.bt.hfrontporch + timings.bt.hsync + timings.bt.hbackporch;
            const int total_height = timings.bt.height + timings.bt.vfrontporch + timings.bt.vsync + timings.bt.vbackporch;
            int64_t framerate_den = 1001;
            int64_t framerate_num = av_rescale(timings.bt.pixelclock, framerate_den, (int64_t)total_width * total_height);
            framerate_num = ((framerate_num + 5) / 10) * 10; // round by 10
            if (framerate_num % 1000 == 0) {
                tpf->numerator   = framerate_den;
                tpf->denominator = framerate_num;
            } else {
                int framerate_num_dst = 0, framerate_den_dst = 0;
                framerate_den = 1000;
                framerate_num = av_rescale(timings.bt.pixelclock, framerate_den, (int64_t)total_width * total_height);
                framerate_num = ((framerate_num + 5) / 10) * 10; // round by 10
                av_reduce(&framerate_num_dst, &framerate_den_dst, framerate_num, framerate_den, INT_MAX);
                tpf->numerator   = framerate_den_dst;
                tpf->denominator = framerate_num_dst;
            }
            av_log(ctx, AV_LOG_WARNING, "ioctl(VIDIOC_G_PARM): %s, estimated framerate %d/%d from dv timings.\n",
                av_err2str(ret), tpf->denominator, tpf->numerator);
        } else if (framerate_q.num && framerate_q.den) {
            if (streamparm.parm.capture.capability & V4L2_CAP_TIMEPERFRAME) {
                tpf = &streamparm.parm.capture.timeperframe;

                av_log(ctx, AV_LOG_DEBUG, "Setting time per frame to %d/%d\n",
                       framerate_q.den, framerate_q.num);
                tpf->numerator   = framerate_q.den;
                tpf->denominator = framerate_q.num;

                if (v4l2_ioctl(s->fd, VIDIOC_S_PARM, &streamparm) < 0) {
                    ret = AVERROR(errno);
                    av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_S_PARM): %s\n",
                           av_err2str(ret));
                    return ret;
                }

                if (framerate_q.num != tpf->denominator ||
                    framerate_q.den != tpf->numerator) {
                    av_log(ctx, AV_LOG_INFO,
                           "The driver changed the time per frame from "
                           "%d/%d to %d/%d\n",
                           framerate_q.den, framerate_q.num,
                           tpf->numerator, tpf->denominator);
                }
            } else {
                // use user defined framerate for further error cases.
                tpf->numerator   = framerate_q.den;
                tpf->denominator = framerate_q.num;
                av_log(ctx, AV_LOG_WARNING, "ioctl(VIDIOC_G_PARM): %s, using framerate %d/%d\n",
                    av_err2str(ret), framerate_q.num, framerate_q.den);
            }
        } else {
            av_log(ctx, AV_LOG_WARNING, "ioctl(VIDIOC_G_PARM): %s\n", av_err2str(ret));
        }
#endif        
    } else if (framerate_q.num && framerate_q.den) {
        if (streamparm.parm.capture.capability & V4L2_CAP_TIMEPERFRAME) {
            tpf = &streamparm.parm.capture.timeperframe;

            av_log(ctx, AV_LOG_DEBUG, "Setting time per frame to %d/%d\n",
                   framerate_q.den, framerate_q.num);
            tpf->numerator   = framerate_q.den;
            tpf->denominator = framerate_q.num;

            if (v4l2_ioctl(s->fd, VIDIOC_S_PARM, &streamparm) < 0) {
                ret = AVERROR(errno);
                av_log(ctx, AV_LOG_ERROR, "ioctl(VIDIOC_S_PARM): %s\n",
                       av_err2str(ret));
                return ret;
            }

            if (framerate_q.num != tpf->denominator ||
                framerate_q.den != tpf->numerator) {
                av_log(ctx, AV_LOG_INFO,
                       "The driver changed the time per frame from "
                       "%d/%d to %d/%d\n",
                       framerate_q.den, framerate_q.num,
                       tpf->numerator, tpf->denominator);
            }
        } else {
            av_log(ctx, AV_LOG_WARNING,
                   "The driver does not permit changing the time per frame\n");
        }
    }
    if (tpf->denominator > 0 && tpf->numerator > 0) {
        ctx->streams[0]->avg_frame_rate.num = tpf->denominator;
        ctx->streams[0]->avg_frame_rate.den = tpf->numerator;
        ctx->streams[0]->r_frame_rate = ctx->streams[0]->avg_frame_rate;
    } else
        av_log(ctx, AV_LOG_WARNING, "Time per frame unknown\n");

    return 0;
}
avafinger commented 10 months ago

Tested webcam and imx-415

Webcam:

sudo ../FFmpeg-encoder-new-2/ffmpeg -f v4l2 -pixel_format yuyv422 -framerate 30 -video_size 1920x1080 -i /dev/video22  out3.h264
ffmpeg version e243e8d Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
  configuration: --prefix=/usr --disable-libopenh264 --disable-vaapi --disable-vdpau --disable-decoder=h264_v4l2m2m --disable-decoder=vp8_v4l2m2m --disable-decoder=mpeg2_v4l2m2m --disable-decoder=mpeg4_v4l2m2m --disable-libxvid --disable-libx264 --disable-libx265 --enable-rkmpp --enable-nonfree --enable-gpl --enable-version3 --enable-libmp3lame --enable-libpulse --enable-libv4l2 --enable-libdrm --enable-libxml2 --enable-librtmp --enable-libfreetype --enable-openssl --enable-opengl --enable-libopus --enable-libvorbis --disable-shared --enable-decoder='aac,ac3,flac' --extra-cflags=-I/usr/src/linux-headers-5.10.110-rk3588-v4l2/include --disable-cuvid --disable-stripping --disable-optimizations --extra-cflags=-Og --extra-cflags=-fno-omit-frame-pointer --enable-debug=3 --extra-cflags=-fno-inline
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
[video4linux2,v4l2 @ 0x557de40b90] The driver changed the time per frame from 1/30 to 1/5
Input #0, video4linux2,v4l2, from '/dev/video22':
  Duration: N/A, start: 268797.047561, bitrate: 165888 kb/s
  Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 1920x1080, 165888 kb/s, 5 fps, 5 tbr, 1000k tbn
File 'out3.h264' already exists. Overwrite? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_rkmpp_encoder))
Press [q] to stop, [?] for help
[h264_rkmpp_encoder @ 0x557de43730] Picture format is yuyv422.
[h264_rkmpp_encoder @ 0x557de43730] Rate Control mode is set to CBR
[h264_rkmpp_encoder @ 0x557de43730] Bitrate Target/Min/Max is set to 6000000/5625000/6375000
[h264_rkmpp_encoder @ 0x557de43730] Profile is set to HIGH
[h264_rkmpp_encoder @ 0x557de43730] 8x8 Transform is enabled
[h264_rkmpp_encoder @ 0x557de43730] Level is set to 0
[h264_rkmpp_encoder @ 0x557de43730] Coder is set to CABAC
[h264_rkmpp_encoder @ 0x557de43730] Quality Min/Max is set to 50%(Quant=30) / 100%(Quant=10)
Output #0, h264, to 'out3.h264':
  Metadata:
    encoder         : Lavf60.3.100
  Stream #0:0: Video: h264 (High), yuyv422(progressive), 1920x1080, q=2-31, 6000 kb/s, 5 fps, 5 tbn
    Metadata:
      encoder         : Lavc60.3.100 h264_rkmpp_encoder
[h264_rkmpp_encoder @ 0x557de43730] Reconfigured with w=1920, h=1080, format=yuyv422.
frame=    0 fps=0.0 q=-0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=N/frame=   28 fps=0.0 q=-0.0 size=    3328kB time=00:00:05.40 bitrate=5048.7kbits/frame=   31 fps= 24 q=-0.0 size=    3840kB time=00:00:06.00 bitrate=5242.9kbits/frame=   34 fps= 18 q=-0.0 size=    4096kB time=00:00:06.60 bitrate=5084.0kbits/frame=   37 fps= 15 q=-0.0 size=    4608kB time=00:00:07.20 bitrate=5242.9kbits/frame=   40 fps= 13 q=-0.0 size=    5120kB time=00:00:07.80 bitrate=5377.3kbits/frame=   43 fps= 12 q=-0.0 size=    5376kB time=00:00:08.40 bitrate=5242.9kbits/frame=   45 fps= 10 q=-0.0 size=    5888kB time=00:00:09.00 bitrate=5359.4kbits/frame=   48 fps=9.8 q=-0.0 size=    6144kB time=00:00:09.60 bitrate=5242.9kbits/frame=   51 fps=9.3 q=-0.0 size=    6656kB time=00:00:10.20 bitrate=5345.7kbits/frame=   54 fps=8.9 q=-0.0 size=    6912kB time=00:00:10.80 bitrate=5242.9kbits/frame=   57 fps=8.5 q=-0.0 size=    7424kB time=00:00:11.40 bitrate=5334.9kbits/frame=   60 fps=8.2 q=-0.0 size=    7936kB time=00:00:12.00 bitrate=5417.6kbits/frame=   63 fps=8.0 q=-0.0 size=    8704kB time=00:00:12.60 bitrate=5659.0kbits/frame=   66 fps=7.8 q=-0.0 size=    9216kB time=00:00:13.20 bitrate=5719.5kbits/frame=   68 fps=7.6 q=-0.0 Lsize=    9646kB time=00:00:13.40 bitrate=5897.1kbits/s speed=1.51x    
video:9646kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Exiting normally, received signal 2.

IMX-415

sudo ../FFmpeg-encoder-new-2/ffmpeg -f v4l2 -pixel_format nv12 -framerate 30 -video_size 1920x1080 -i /dev/video11  out3.h264
[sudo] password for rock: 
ffmpeg version e243e8d Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 11 (Ubuntu 11.4.0-1ubuntu1~22.04)
  configuration: --prefix=/usr --disable-libopenh264 --disable-vaapi --disable-vdpau --disable-decoder=h264_v4l2m2m --disable-decoder=vp8_v4l2m2m --disable-decoder=mpeg2_v4l2m2m --disable-decoder=mpeg4_v4l2m2m --disable-libxvid --disable-libx264 --disable-libx265 --enable-rkmpp --enable-nonfree --enable-gpl --enable-version3 --enable-libmp3lame --enable-libpulse --enable-libv4l2 --enable-libdrm --enable-libxml2 --enable-librtmp --enable-libfreetype --enable-openssl --enable-opengl --enable-libopus --enable-libvorbis --disable-shared --enable-decoder='aac,ac3,flac' --extra-cflags=-I/usr/src/linux-headers-5.10.110-rk3588-v4l2/include --disable-cuvid --disable-stripping --disable-optimizations --extra-cflags=-Og --extra-cflags=-fno-omit-frame-pointer --enable-debug=3 --extra-cflags=-fno-inline
  libavutil      58.  2.100 / 58.  2.100
  libavcodec     60.  3.100 / 60.  3.100
  libavformat    60.  3.100 / 60.  3.100
  libavdevice    60.  1.100 / 60.  1.100
  libavfilter     9.  3.100 /  9.  3.100
  libswscale      7.  1.100 /  7.  1.100
  libswresample   4. 10.100 /  4. 10.100
  libpostproc    57.  1.100 / 57.  1.100
[video4linux2,v4l2 @ 0x5560995b90] ioctl(VIDIOC_G_INPUT): Inappropriate ioctl for device
[video4linux2,v4l2 @ 0x5560995b90] ioctl(VIDIOC_G_PARM): Inappropriate ioctl for device, using framerate 30/1
Input #0, video4linux2,v4l2, from '/dev/video11':
  Duration: N/A, start: 269861.426456, bitrate: 746496 kb/s
  Stream #0:0: Video: rawvideo (NV12 / 0x3231564E), nv12, 1920x1080, 746496 kb/s, 30 fps, 30 tbr, 1000k tbn
File 'out3.h264' already exists. Overwrite? [y/N] y
Stream mapping:
  Stream #0:0 -> #0:0 (rawvideo (native) -> h264 (h264_rkmpp_encoder))
Press [q] to stop, [?] for help
[h264_rkmpp_encoder @ 0x5560998730] Picture format is nv12.
[h264_rkmpp_encoder @ 0x5560998730] Rate Control mode is set to CBR
[h264_rkmpp_encoder @ 0x5560998730] Bitrate Target/Min/Max is set to 6000000/5625000/6375000
[h264_rkmpp_encoder @ 0x5560998730] Profile is set to HIGH
[h264_rkmpp_encoder @ 0x5560998730] 8x8 Transform is enabled
[h264_rkmpp_encoder @ 0x5560998730] Level is set to 0
[h264_rkmpp_encoder @ 0x5560998730] Coder is set to CABAC
[h264_rkmpp_encoder @ 0x5560998730] Quality Min/Max is set to 50%(Quant=30) / 100%(Quant=10)
Output #0, h264, to 'out3.h264':
  Metadata:
    encoder         : Lavf60.3.100
  Stream #0:0: Video: h264 (High), nv12(progressive), 1920x1080, q=2-31, 6000 kb/s, 30 fps, 30 tbn
    Metadata:
      encoder         : Lavc60.3.100 h264_rkmpp_encoder
[h264_rkmpp_encoder @ 0x5560998730] Reconfigured with w=1920, h=1080, format=nv12.
frame=    0 fps=0.0 q=-0.0 size=       0kB time=00:00:00.00 bitrate=N/A speed=N/frame=   92 fps=0.0 q=-0.0 size=    2048kB time=00:00:03.03 bitrate=5531.0kbits/frame=  112 fps=109 q=-0.0 size=    2560kB time=00:00:03.73 bitrate=5617.4kbits/frame=  129 fps= 83 q=-0.0 size=    3072kB time=00:00:04.26 bitrate=5898.2kbits/frame=  145 fps= 69 q=-0.0 size=    3328kB time=00:00:04.80 bitrate=5679.8kbits/frame=  160 fps= 61 q=-0.0 size=    3840kB time=00:00:05.33 bitrate=5898.2kbits/frame=  176 fps= 56 q=-0.0 size=    4096kB time=00:00:05.86 bitrate=5719.5kbits/frame=  191 fps= 52 q=-0.0 size=    4608kB time=00:00:06.36 bitrate=5929.1kbits/frame=  207 fps= 50 q=-0.0 size=    4864kB time=00:00:06.86 bitrate=5802.8kbits/frame=  223 fps= 48 q=-0.0 size=    5120kB time=00:00:07.40 bitrate=5668.0kbits/frame=  238 fps= 46 q=-0.0 size=    5632kB time=00:00:07.90 bitrate=5840.2kbits/frame=  250 fps= 44 q=-0.0 Lsize=    6120kB time=00:00:08.30 bitrate=6040.0kbits/s dup=20 drop=0 speed=1.47x    
video:6120kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
Exiting normally, received signal 2.
avafinger commented 10 months ago

Just a question for you, i would like to backport your work to 5.1 (debian bookworm) due to that mpp change. Do you have plans for that? I usually stick with distro version, so it does not break any other dependencies...

hbiyik commented 10 months ago

i can backport 5.x easily, is 5.1.3 ok for you?

hbiyik commented 10 months ago

not tested: https://github.com/hbiyik/FFmpeg/commits/mpp-rga-ffmpeg-5