[FFmpeg-devel] fail to seek key video packet

qw applemax82 at 163.com
Fri Feb 2 16:30:07 EET 2018


Hi,


I use following command to test ffmpeg-2.8.1:


ffmpeg -debug_ts -ss 10 -t 1 -i hanma.ts -f null /dev/null




ffmpeg version 2.8.1 Copyright (c) 2000-2015 the FFmpeg developers
  built with icc (ICC) 14.0.2 20140120
  configuration: --cc=/opt/intel/bin/icc --enable-version3 --enable-asm --enable-yasm --enable-avfilter --disable-static --enable-shared --enable-gpl --enable-nonfree --prefix=/usr/local/ --extra-cflags='-I/usr/local/include --extra-ldflags=-L/usr/local/lib' --enable-memalign-hack --enable-stripping
  libavutil      54. 31.100 / 54. 31.100
  libavcodec     56. 60.100 / 56. 60.100
  libavformat    56. 40.101 / 56. 40.101
  libavdevice    56.  4.100 / 56.  4.100
  libavfilter     5. 40.101 /  5. 40.101
  libswscale      3.  1.101 /  3.  1.101
  libswresample   1.  2.101 /  1.  2.101
  libpostproc    53.  3.100 / 53.  3.100
Input #0, mpegts, from './sampleClips/jd-testClips/clips03/hanma.ts':
  Duration: 00:02:39.78, start: 1.400000, bitrate: 10913 kb/s
  Program 1 
    Metadata:
      service_name    : Service01
      service_provider: FFmpeg
    Stream #0:0[0x100]: Video: h264 (Constrained Baseline) ([27][0][0][0] / 0x001B), yuv420p, 1280x720 [SAR 3:4 DAR 4:3], 24 fps, 24 tbr, 90k tbn, 48 tbc
    Stream #0:1[0x101]: Audio: ac3 ([129][0][0][0] / 0x0081), 48000 Hz, stereo, fltp, 192 kb/s
Output #0, null, to '/dev/null':
  Metadata:
    encoder         : Lavf56.40.101
    Stream #0:0: Video: rawvideo (I420 / 0x30323449), yuv420p, 1280x720 [SAR 3:4 DAR 4:3], q=2-31, 200 kb/s, 24 fps, 24 tbn, 24 tbc
    Metadata:
      encoder         : Lavc56.60.100 rawvideo
    Stream #0:1: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
    Metadata:
      encoder         : Lavc56.60.100 pcm_s16le
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> rawvideo (native))
  Stream #0:1 -> #0:1 (ac3 (native) -> pcm_s16le (native))
Press [q] to stop, [?] for help
demuxer -> ist_index:1 type:audio next_dts:NOPTS next_dts_time:NOPTS next_pts:NOPTS next_pts_time:NOPTS pkt_pts:1024560 pkt_pts_time:11.384 pkt_dts:1024560 pkt_dts_time:11.384 off:-11400000 off_time:-11.4
demuxer+ffmpeg -> ist_index:1 type:audio pkt_pts:-1440 pkt_pts_time:-0.016 pkt_dts:-1440 pkt_dts_time:-0.016 off:-11400000 off_time:-11.4
encoder <- type:audio frame_pts:0 frame_pts_time:0 time_base:1/48000
encoder -> type:audio pkt_pts:0 pkt_pts_time:0 pkt_dts:0 pkt_dts_time:0
muxer <- type:audio pkt_pts:0 pkt_pts_time:0 pkt_dts:0 pkt_dts_time:0 size:3072
demuxer -> ist_index:1 type:audio next_dts:16000 next_dts_time:0.016 next_pts:16000 next_pts_time:0.016 pkt_pts:1027440 pkt_pts_time:11.416 pkt_dts:1027440 pkt_dts_time:11.416 off:-11400000 off_time:-11.4
demuxer+ffmpeg -> ist_index:1 type:audio pkt_pts:1440 pkt_pts_time:0.016 pkt_dts:1440 pkt_dts_time:0.016 off:-11400000 off_time:-11.4
encoder <- type:audio frame_pts:768 frame_pts_time:0.016 time_base:1/48000
encoder -> type:audio pkt_pts:768 pkt_pts_time:0.016 pkt_dts:768 pkt_dts_time:0.016
muxer <- type:audio pkt_pts:768 pkt_pts_time:0.016 pkt_dts:768 pkt_dts_time:0.016 size:6144
demuxer -> ist_index:1 type:audio next_dts:48000 next_dts_time:0.048 next_pts:48000 next_pts_time:0.048 pkt_pts:1030320 pkt_pts_time:11.448 pkt_dts:1030320 pkt_dts_time:11.448 off:-11400000 off_time:-11.4
demuxer+ffmpeg -> ist_index:1 type:audio pkt_pts:4320 pkt_pts_time:0.048 pkt_dts:4320 pkt_dts_time:0.048 off:-11400000 off_time:-11.4
encoder <- type:audio frame_pts:2304 frame_pts_time:0.048 time_base:1/48000
encoder -> type:audio pkt_pts:2304 pkt_pts_time:0.048 pkt_dts:2304 pkt_dts_time:0.048
muxer <- type:audio pkt_pts:2304 pkt_pts_time:0.048 pkt_dts:2304 pkt_dts_time:0.048 size:6144
demuxer -> ist_index:0 type:video next_dts:NOPTS next_dts_time:NOPTS next_pts:NOPTS next_pts_time:NOPTS pkt_pts:1026000 pkt_pts_time:11.4 pkt_dts:1026000 pkt_dts_time:11.4 off:-11400000 off_time:-11.4
demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:0 pkt_pts_time:0 pkt_dts:0 pkt_dts_time:0 off:-11400000 off_time:-11.4
demuxer -> ist_index:0 type:video next_dts:41667 next_dts_time:0.041667 next_pts:0 next_pts_time:0 pkt_pts:1029750 pkt_pts_time:11.4417 pkt_dts:1029750 pkt_dts_time:11.4417 off:-11400000 off_time:-11.4
demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:3750 pkt_pts_time:0.0416667 pkt_dts:3750 pkt_dts_time:0.0416667 off:-11400000 off_time:-11.4
[h264 @ 0x1bdbda0] Missing reference picture, default is 0
[h264 @ 0x1bdbda0] decode_slice_header error
demuxer -> ist_index:0 type:video next_dts:83334 next_dts_time:0.083334 next_pts:0 next_pts_time:0 pkt_pts:1033500 pkt_pts_time:11.4833 pkt_dts:1033500 pkt_dts_time:11.4833 off:-11400000 off_time:-11.4
demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:7500 pkt_pts_time:0.0833333 pkt_dts:7500 pkt_dts_time:0.0833333 off:-11400000 off_time:-11.4
demuxer -> ist_index:1 type:audio next_dts:80000 next_dts_time:0.08 next_pts:80000 next_pts_time:0.08 pkt_pts:1033200 pkt_pts_time:11.48 pkt_dts:1033200 pkt_dts_time:11.48 off:-11400000 off_time:-11.4
demuxer+ffmpeg -> ist_index:1 type:audio pkt_pts:7200 pkt_pts_time:0.08 pkt_dts:7200 pkt_dts_time:0.08 off:-11400000 off_time:-11.4
encoder <- type:audio frame_pts:3840 frame_pts_time:0.08 time_base:1/48000
encoder -> type:audio pkt_pts:3840 pkt_pts_time:0.08 pkt_dts:3840 pkt_dts_time:0.08
muxer <- type:audio pkt_pts:3840 pkt_pts_time:0.08 pkt_dts:3840 pkt_dts_time:0.08 size:6144
demuxer -> ist_index:1 type:audio next_dts:112000 next_dts_time:0.112 next_pts:112000 next_pts_time:0.112 pkt_pts:1036080 pkt_pts_time:11.512 pkt_dts:1036080 pkt_dts_time:11.512 off:-11400000 off_time:-11.4
demuxer+ffmpeg -> ist_index:1 type:audio pkt_pts:10080 pkt_pts_time:0.112 pkt_dts:10080 pkt_dts_time:0.112 off:-11400000 off_time:-11.4
encoder <- type:audio frame_pts:5376 frame_pts_time:0.112 time_base:1/48000
encoder -> type:audio pkt_pts:5376 pkt_pts_time:0.112 pkt_dts:5376 pkt_dts_time:0.112
muxer <- type:audio pkt_pts:5376 pkt_pts_time:0.112 pkt_dts:5376 pkt_dts_time:0.112 size:6144
demuxer -> ist_index:1 type:audio next_dts:144000 next_dts_time:0.144 next_pts:144000 next_pts_time:0.144 pkt_pts:1038960 pkt_pts_time:11.544 pkt_dts:1038960 pkt_dts_time:11.544 off:-11400000 off_time:-11.4
demuxer+ffmpeg -> ist_index:1 type:audio pkt_pts:12960 pkt_pts_time:0.144 pkt_dts:12960 pkt_dts_time:0.144 off:-11400000 off_time:-11.4
encoder <- type:audio frame_pts:6912 frame_pts_time:0.144 time_base:1/48000
encoder -> type:audio pkt_pts:6912 pkt_pts_time:0.144 pkt_dts:6912 pkt_dts_time:0.144
muxer <- type:audio pkt_pts:6912 pkt_pts_time:0.144 pkt_dts:6912 pkt_dts_time:0.144 size:6144
demuxer -> ist_index:0 type:video next_dts:125000 next_dts_time:0.125 next_pts:0 next_pts_time:0 pkt_pts:1037250 pkt_pts_time:11.525 pkt_dts:1037250 pkt_dts_time:11.525 off:-11400000 off_time:-11.4
demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:11250 pkt_pts_time:0.125 pkt_dts:11250 pkt_dts_time:0.125 off:-11400000 off_time:-11.4
demuxer -> ist_index:0 type:video next_dts:166667 next_dts_time:0.166667 next_pts:0 next_pts_time:0 pkt_pts:1041000 pkt_pts_time:11.5667 pkt_dts:1041000 pkt_dts_time:11.5667 off:-11400000 off_time:-11.4
demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:15000 pkt_pts_time:0.166667 pkt_dts:15000 pkt_dts_time:0.166667 off:-11400000 off_time:-11.4
demuxer -> ist_index:1 type:audio next_dts:176000 next_dts_time:0.176 next_pts:176000 next_pts_time:0.176 pkt_pts:1041840 pkt_pts_time:11.576 pkt_dts:1041840 pkt_dts_time:11.576 off:-11400000 off_time:-11.4
demuxer+ffmpeg -> ist_index:1 type:audio pkt_pts:15840 pkt_pts_time:0.176 pkt_dts:15840 pkt_dts_time:0.176 off:-11400000 off_time:-11.4
encoder <- type:audio frame_pts:8448 frame_pts_time:0.176 time_base:1/48000
encoder -> type:audio pkt_pts:8448 pkt_pts_time:0.176 pkt_dts:8448 pkt_dts_time:0.176
muxer <- type:audio pkt_pts:8448 pkt_pts_time:0.176 pkt_dts:8448 pkt_dts_time:0.176 size:6144
demuxer -> ist_index:1 type:audio next_dts:208000 next_dts_time:0.208 next_pts:208000 next_pts_time:0.208 pkt_pts:1044720 pkt_pts_time:11.608 pkt_dts:1044720 pkt_dts_time:11.608 off:-11400000 off_time:-11.4
demuxer+ffmpeg -> ist_index:1 type:audio pkt_pts:18720 pkt_pts_time:0.208 pkt_dts:18720 pkt_dts_time:0.208 off:-11400000 off_time:-11.4
encoder <- type:audio frame_pts:9984 frame_pts_time:0.208 time_base:1/48000
encoder -> type:audio pkt_pts:9984 pkt_pts_time:0.208 pkt_dts:9984 pkt_dts_time:0.208
muxer <- type:audio pkt_pts:9984 pkt_pts_time:0.208 pkt_dts:9984 pkt_dts_time:0.208 size:6144
demuxer -> ist_index:1 type:audio next_dts:240000 next_dts_time:0.24 next_pts:240000 next_pts_time:0.24 pkt_pts:1047600 pkt_pts_time:11.64 pkt_dts:1047600 pkt_dts_time:11.64 off:-11400000 off_time:-11.4
demuxer+ffmpeg -> ist_index:1 type:audio pkt_pts:21600 pkt_pts_time:0.24 pkt_dts:21600 pkt_dts_time:0.24 off:-11400000 off_time:-11.4
encoder <- type:audio frame_pts:11520 frame_pts_time:0.24 time_base:1/48000
encoder -> type:audio pkt_pts:11520 pkt_pts_time:0.24 pkt_dts:11520 pkt_dts_time:0.24


I use ffprobe to get video packet information, including pts/dts:
/usr/local/bin/ffprobe -show_packets -select_streams v hanma.ts


I found 1st video packet is not key packet by comparing pts/dts


demuxer -> ist_index:0 type:video next_dts:NOPTS next_dts_time:NOPTS next_pts:NOPTS next_pts_time:NOPTS pkt_pts:1026000 pkt_pts_time:11.4 pkt_dts:1026000 pkt_dts_time:11.4 off:-11400000 off_time:-11.4
demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:0 pkt_pts_time:0 pkt_dts:0 pkt_dts_time:0 off:-11400000 off_time:-11.4
demuxer -> ist_index:0 type:video next_dts:41667 next_dts_time:0.041667 next_pts:0 next_pts_time:0 pkt_pts:1029750 pkt_pts_time:11.4417 pkt_dts:1029750 pkt_dts_time:11.4417 off:-11400000 off_time:-11.4
demuxer+ffmpeg -> ist_index:0 type:video pkt_pts:3750 pkt_pts_time:0.0416667 pkt_dts:3750 pkt_dts_time:0.0416667 off:-11400000 off_time:-11.4
[h264 @ 0x1bdbda0] Missing reference picture, default is 0
[h264 @ 0x1bdbda0] decode_slice_header error


But according to avformat_seek_file()'s description:
http://ffmpeg.org/doxygen/2.8/group__lavf__decoding.html#ga3b40fc8d2fda6992ae6ea2567d71ba30
1st video packet should be key packet after calling avformat_seek_file().


But for hanma.ts, it's not the case.




The test clip can be downloaded from:
https://pan.baidu.com/s/1bqxMDHX


Is it a bug in ffmpeg ts demuxer?




Thanks!


Regard


Andrew



More information about the ffmpeg-devel mailing list