[FFmpeg-trac] #5120(undetermined:new): Incorrect start frame when converting mpeg2video to mp4

FFmpeg trac at avcodec.org
Sun Jan 3 21:40:41 CET 2016


#5120: Incorrect start frame when converting mpeg2video to mp4
-------------------------------------+-------------------------------------
             Reporter:  sroy8        |                    Owner:
                 Type:  defect       |                   Status:  new
             Priority:  normal       |                Component:
              Version:  unspecified  |  undetermined
             Keywords:  mov          |               Resolution:
             Blocking:               |               Blocked By:
Analyzed by developer:  0            |  Reproduced by developer:  0
-------------------------------------+-------------------------------------

Comment (by sroy8):

 I've confirmed that the bug still exists at git head.  Here is the output
 from running ffmpeg on incorrect-start-frame.mov:

 {{{
 % ffmpeg -report -i incorrect-start-frame.mov incorrect-start-frame.mp4
 ffmpeg started on 2016-01-03 at 12:35:04
 Report written to "ffmpeg-20160103-123504.log"
 ffmpeg version N-77671-g97c162a Copyright (c) 2000-2016 the FFmpeg
 developers
   built with Apple LLVM version 7.0.2 (clang-700.1.81)
   configuration:
   libavutil      55. 12.100 / 55. 12.100
   libavcodec     57. 21.100 / 57. 21.100
   libavformat    57. 21.100 / 57. 21.100
   libavdevice    57.  0.100 / 57.  0.100
   libavfilter     6. 23.100 /  6. 23.100
   libswscale      4.  0.100 /  4.  0.100
   libswresample   2.  0.101 /  2.  0.101
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fafe2802000] ignoring 'frma' atom of 'fl32',
 stream format is 'fl32'
 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'incorrect-start-frame.mov':
   Metadata:
     major_brand     : qt
     minor_version   : 0
     compatible_brands: qt
     creation_time   : 2016-01-01 21:40:51
     com.apple.proapps.manufacturer: Canon
     com.apple.proapps.modelname: HV20
     com.apple.proapps.cameraID:   0x8500014e7616
     com.apple.proapps.cameraName: Canon HV20
     com.apple.proapps.clipID: 013DBAE2-5BEA-411E-8CB7-6CE523785DDA
     com.apple.proapps.ingestDate.description: 2016-01-01 13:40:51 -0800
     com.apple.proapps.originalFormat: HDV 1080i60
     com.apple.proapps.mediaRate: @>
     com.apple.proapps.timecodeFormat: Drop
     com.apple.quicktime.creationdate: 2015-12-28T18:01:18-0800
     com.apple.quicktime.make: Apple
     com.apple.quicktime.model: MacBookPro8,2
     com.apple.quicktime.software: Mac OS X 10.11.2 (15C50)
   Duration: 00:00:00.70, start: 0.522533, bitrate: 46718 kb/s
     Stream #0:0(und): Video: mpeg2video (Main) (hdv2 / 0x32766468),
 yuv420p(tv, bt709), 1440x1080 [SAR 4:3 DAR 16:9], 25000 kb/s, 29.97 fps,
 29.97 tbr, 30k tbn, 59.94 tbc (default)
     Metadata:
       creation_time   : 2016-01-01 21:40:51
       handler_name    : Core Media Data Handler
       encoder         : HDV 1080i60
       timecode        : 00:50:34;09
     Stream #0:1(und): Audio: pcm_f32le (fl32 / 0x32336C66), 48000 Hz,
 stereo, flt, 3072 kb/s (default)
     Metadata:
       creation_time   : 2016-01-01 21:40:51
       handler_name    : Core Media Data Handler
     Stream #0:2(und): Data: none (tmcd / 0x64636D74), 0 kb/s
     Metadata:
       creation_time   : 2016-01-01 21:40:51
       handler_name    : Core Media Data Handler
       timecode        : 00:50:34;09
 Output #0, mp4, to 'incorrect-start-frame.mp4':
   Metadata:
     major_brand     : qt
     minor_version   : 0
     compatible_brands: qt
     com.apple.quicktime.software: Mac OS X 10.11.2 (15C50)
     com.apple.proapps.manufacturer: Canon
     com.apple.proapps.modelname: HV20
     com.apple.proapps.cameraID:   0x8500014e7616
     com.apple.proapps.cameraName: Canon HV20
     com.apple.proapps.clipID: 013DBAE2-5BEA-411E-8CB7-6CE523785DDA
     com.apple.proapps.ingestDate.description: 2016-01-01 13:40:51 -0800
     com.apple.proapps.originalFormat: HDV 1080i60
     com.apple.proapps.mediaRate: @>
     com.apple.proapps.timecodeFormat: Drop
     com.apple.quicktime.creationdate: 2015-12-28T18:01:18-0800
     com.apple.quicktime.make: Apple
     com.apple.quicktime.model: MacBookPro8,2
     encoder         : Lavf57.21.100
     Stream #0:0(und): Video: mpeg4 ( [0][0][0] / 0x0020), yuv420p,
 1440x1080 [SAR 4:3 DAR 16:9], q=2-31, 200 kb/s, 29.97 fps, 30k tbn, 29.97
 tbc (default)
     Metadata:
       creation_time   : 2016-01-01 21:40:51
       handler_name    : Core Media Data Handler
       timecode        : 00:50:34;09
       encoder         : Lavc57.21.100 mpeg4
     Side data:
       unknown side data type 10 (24 bytes)
     Stream #0:1(und): Audio: aac (LC) ([64][0][0][0] / 0x0040), 48000 Hz,
 stereo, fltp, 128 kb/s (default)
     Metadata:
       creation_time   : 2016-01-01 21:40:51
       handler_name    : Core Media Data Handler
       encoder         : Lavc57.21.100 aac
 Stream mapping:
   Stream #0:0 -> #0:0 (mpeg2video (native) -> mpeg4 (native))
   Stream #0:1 -> #0:1 (pcm_f32le (native) -> aac (native))
 Press [q] to stop, [?] for help
 frame=   37 fps=0.0 q=24.8 Lsize=    1081kB time=00:00:01.23
 bitrate=7170.2kbits/s dup=5 drop=0 speed=3.09x
 video:1061kB audio:17kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: 0.214646%
 [aac @ 0x7fafe1813c00] Qavg: 193.488
 }}}

 Here is the corresponding report file:

 {{{
 % cat ffmpeg-20160103-123504.log
 ffmpeg started on 2016-01-03 at 12:35:04
 Report written to "ffmpeg-20160103-123504.log"
 Command line:
 ./ffmpeg -report -i incorrect-start-frame.mov incorrect-start-frame.mp4
 ffmpeg version N-77671-g97c162a Copyright (c) 2000-2016 the FFmpeg
 developers
   built with Apple LLVM version 7.0.2 (clang-700.1.81)
   configuration:
   libavutil      55. 12.100 / 55. 12.100
   libavcodec     57. 21.100 / 57. 21.100
   libavformat    57. 21.100 / 57. 21.100
   libavdevice    57.  0.100 / 57.  0.100
   libavfilter     6. 23.100 /  6. 23.100
   libswscale      4.  0.100 /  4.  0.100
   libswresample   2.  0.101 /  2.  0.101
 Splitting the commandline.
 Reading option '-report' ... matched as option 'report' (generate a
 report) with argument '1'.
 Reading option '-i' ... matched as input file with argument 'incorrect-
 start-frame.mov'.
 Reading option 'incorrect-start-frame.mp4' ... matched as output file.
 Finished splitting the commandline.
 Parsing a group of options: global .
 Applying option report (generate a report) with argument 1.
 Successfully parsed a group of options.
 Parsing a group of options: input file incorrect-start-frame.mov.
 Successfully parsed a group of options.
 Opening an input file: incorrect-start-frame.mov.
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fafe2802000] Format mov,mp4,m4a,3gp,3g2,mj2
 probed with size=2048 and score=100
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fafe2802000] ISO: File Type Major Brand: qt
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fafe2802000] Unknown dref type 0x0873696c61
 size 12
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fafe2802000] Unknown dref type 0x0873696c61
 size 12
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fafe2802000] ignoring 'frma' atom of 'fl32',
 stream format is 'fl32'
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fafe2802000] Unknown dref type 0x0873696c61
 size 12
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fafe2802000] Before
 avformat_find_stream_info() pos: 4091925 bytes read:43050 seeks:1
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fafe2802000] All info found
 [mov,mp4,m4a,3gp,3g2,mj2 @ 0x7fafe2802000] After
 avformat_find_stream_info() pos: 1556480 bytes read:1619501 seeks:2
 frames:16
 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'incorrect-start-frame.mov':
   Metadata:
     major_brand     : qt
     minor_version   : 0
     compatible_brands: qt
     creation_time   : 2016-01-01 21:40:51
     com.apple.proapps.manufacturer: Canon
     com.apple.proapps.modelname: HV20
     com.apple.proapps.cameraID:   0x8500014e7616
     com.apple.proapps.cameraName: Canon HV20
     com.apple.proapps.clipID: 013DBAE2-5BEA-411E-8CB7-6CE523785DDA
     com.apple.proapps.ingestDate.description: 2016-01-01 13:40:51 -0800
     com.apple.proapps.originalFormat: HDV 1080i60
     com.apple.proapps.mediaRate: @>
     com.apple.proapps.timecodeFormat: Drop
     com.apple.quicktime.creationdate: 2015-12-28T18:01:18-0800
     com.apple.quicktime.make: Apple
     com.apple.quicktime.model: MacBookPro8,2
     com.apple.quicktime.software: Mac OS X 10.11.2 (15C50)
   Duration: 00:00:00.70, start: 0.522533, bitrate: 46718 kb/s
     Stream #0:0(und), 15, 1/30000: Video: mpeg2video (Main) (hdv2 /
 0x32766468), yuv420p(tv, bt709), 1440x1080 [SAR 4:3 DAR 16:9], 25000 kb/s,
 29.97 fps, 29.97 tbr, 30k tbn, 59.94 tbc (default)
     Metadata:
       creation_time   : 2016-01-01 21:40:51
       handler_name    : Core Media Data Handler
       encoder         : HDV 1080i60
       timecode        : 00:50:34;09
     Stream #0:1(und), 1, 1/48000: Audio: pcm_f32le (fl32 / 0x32336C66),
 48000 Hz, stereo, flt, 3072 kb/s (default)
     Metadata:
       creation_time   : 2016-01-01 21:40:51
       handler_name    : Core Media Data Handler
     Stream #0:2(und), 0, 1/30000: Data: none (tmcd / 0x64636D74), 0 kb/s
     Metadata:
       creation_time   : 2016-01-01 21:40:51
       handler_name    : Core Media Data Handler
       timecode        : 00:50:34;09
 Successfully opened the file.
 Parsing a group of options: output file incorrect-start-frame.mp4.
 Successfully parsed a group of options.
 Opening an output file: incorrect-start-frame.mp4.
 Successfully opened the file.
 detected 8 logical cores
 [graph 0 input from stream 0:0 @ 0x7fafe140cf00] Setting 'video_size' to
 value '1440x1080'
 [graph 0 input from stream 0:0 @ 0x7fafe140cf00] Setting 'pix_fmt' to
 value '0'
 [graph 0 input from stream 0:0 @ 0x7fafe140cf00] Setting 'time_base' to
 value '1/30000'
 [graph 0 input from stream 0:0 @ 0x7fafe140cf00] Setting 'pixel_aspect' to
 value '4/3'
 [graph 0 input from stream 0:0 @ 0x7fafe140cf00] Setting 'sws_param' to
 value 'flags=2'
 [graph 0 input from stream 0:0 @ 0x7fafe140cf00] Setting 'frame_rate' to
 value '30000/1001'
 [graph 0 input from stream 0:0 @ 0x7fafe140cf00] w:1440 h:1080
 pixfmt:yuv420p tb:1/30000 fr:30000/1001 sar:4/3 sws_param:flags=2
 [format @ 0x7fafe140d4e0] compat: called with args=[yuv420p]
 [format @ 0x7fafe140d4e0] Setting 'pix_fmts' to value 'yuv420p'
 [AVFilterGraph @ 0x7fafe140c9a0] query_formats: 4 queried, 3 merged, 0
 already done, 0 delayed
 [graph 1 input from stream 0:1 @ 0x7fafe1700100] Setting 'time_base' to
 value '1/48000'
 [graph 1 input from stream 0:1 @ 0x7fafe1700100] Setting 'sample_rate' to
 value '48000'
 [graph 1 input from stream 0:1 @ 0x7fafe1700100] Setting 'sample_fmt' to
 value 'flt'
 [graph 1 input from stream 0:1 @ 0x7fafe1700100] Setting 'channel_layout'
 to value '0x3'
 [graph 1 input from stream 0:1 @ 0x7fafe1700100] tb:1/48000 samplefmt:flt
 samplerate:48000 chlayout:0x3
 [audio format for output stream 0:1 @ 0x7fafe17009a0] Setting
 'sample_fmts' to value 'fltp'
 [audio format for output stream 0:1 @ 0x7fafe17009a0] Setting
 'sample_rates' to value
 '96000|88200|64000|48000|44100|32000|24000|22050|16000|12000|11025|8000|7350'
 [audio format for output stream 0:1 @ 0x7fafe17009a0] auto-inserting
 filter 'auto-inserted resampler 0' between the filter 'Parsed_anull_0' and
 the filter 'audio format for output stream 0:1'
 [AVFilterGraph @ 0x7fafe140d980] query_formats: 4 queried, 6 merged, 3
 already done, 0 delayed
 [auto-inserted resampler 0 @ 0x7fafe1701220] [SWR @ 0x7fafe401b200] Using
 fltp internally between filters
 [auto-inserted resampler 0 @ 0x7fafe1701220] ch:2 chl:stereo fmt:flt
 r:48000Hz -> ch:2 chl:stereo fmt:fltp r:48000Hz
 [mpeg4 @ 0x7fafe18a4a00] intra_quant_bias = 0 inter_quant_bias = -64
 Output #0, mp4, to 'incorrect-start-frame.mp4':
   Metadata:
     major_brand     : qt
     minor_version   : 0
     compatible_brands: qt
     com.apple.quicktime.software: Mac OS X 10.11.2 (15C50)
     com.apple.proapps.manufacturer: Canon
     com.apple.proapps.modelname: HV20
     com.apple.proapps.cameraID:   0x8500014e7616
     com.apple.proapps.cameraName: Canon HV20
     com.apple.proapps.clipID: 013DBAE2-5BEA-411E-8CB7-6CE523785DDA
     com.apple.proapps.ingestDate.description: 2016-01-01 13:40:51 -0800
     com.apple.proapps.originalFormat: HDV 1080i60
     com.apple.proapps.mediaRate: @>
     com.apple.proapps.timecodeFormat: Drop
     com.apple.quicktime.creationdate: 2015-12-28T18:01:18-0800
     com.apple.quicktime.make: Apple
     com.apple.quicktime.model: MacBookPro8,2
     encoder         : Lavf57.21.100
     Stream #0:0(und), 0, 1/30000: Video: mpeg4 ( [0][0][0] / 0x0020),
 yuv420p, 1440x1080 [SAR 4:3 DAR 16:9], q=2-31, 200 kb/s, 29.97 fps, 30k
 tbn, 29.97 tbc (default)
     Metadata:
       creation_time   : 2016-01-01 21:40:51
       handler_name    : Core Media Data Handler
       timecode        : 00:50:34;09
       encoder         : Lavc57.21.100 mpeg4
     Side data:
       unknown side data type 10 (24 bytes)
     Stream #0:1(und), 0, 1/48000: Audio: aac (LC) ([64][0][0][0] /
 0x0040), 48000 Hz, stereo, fltp, 128 kb/s (default)
     Metadata:
       creation_time   : 2016-01-01 21:40:51
       handler_name    : Core Media Data Handler
       encoder         : Lavc57.21.100 aac
 Stream mapping:
   Stream #0:0 -> #0:0 (mpeg2video (native) -> mpeg4 (native))
   Stream #0:1 -> #0:1 (pcm_f32le (native) -> aac (native))
 Press [q] to stop, [?] for help
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 *** 3 dup!
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 Clipping frame in rate conversion by 0.339653
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 Clipping frame in rate conversion by 0.339653
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 Clipping frame in rate conversion by 0.339653
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 Clipping frame in rate conversion by 0.339653
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 Clipping frame in rate conversion by 0.339653
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 Clipping frame in rate conversion by 0.339653
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 Clipping frame in rate conversion by 0.339653
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 Clipping frame in rate conversion by 0.339653
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 Clipping frame in rate conversion by 0.339653
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 Clipping frame in rate conversion by 0.339653
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 Clipping frame in rate conversion by 0.339653
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 cur_dts is invalid (this is harmless if it occurs once at the start per
 stream)
 Clipping frame in rate conversion by 0.339653
 Clipping frame in rate conversion by 0.339653
 Clipping frame in rate conversion by 0.339653
 Clipping frame in rate conversion by 0.339653
 Clipping frame in rate conversion by 0.339653
 Clipping frame in rate conversion by 0.339653
 Clipping frame in rate conversion by 0.339653
 Clipping frame in rate conversion by 0.339653
 Clipping frame in rate conversion by 0.339653
 Clipping frame in rate conversion by 0.339653
 Clipping frame in rate conversion by 0.339653
 Clipping frame in rate conversion by 0.339653
 Clipping frame in rate conversion by 0.339653
 Clipping frame in rate conversion by 0.339653
 Clipping frame in rate conversion by 0.339653
 Clipping frame in rate conversion by 0.339653
 Clipping frame in rate conversion by 0.339653
 Clipping frame in rate conversion by 0.339653
 Clipping frame in rate conversion by 0.339653
 *** 2 dup!
 [output stream 0:1 @ 0x7fafe1700480] EOF on sink link output stream
 0:1:default.
 [output stream 0:0 @ 0x7fafe140d220] EOF on sink link output stream
 0:0:default.
 No more output streams to write to, finishing.
 [aac @ 0x7fafe1813c00] Trying to remove 128 more samples than there are in
 the queue
 frame=   37 fps=0.0 q=24.8 Lsize=    1081kB time=00:00:01.23
 bitrate=7170.2kbits/s dup=5 drop=0 speed=3.09x
 video:1061kB audio:17kB subtitle:0kB other streams:0kB global headers:0kB
 muxing overhead: 0.214646%
 Input file #0 (incorrect-start-frame.mov):
   Input stream #0:0 (video): 34 packets read (3636809 bytes); 32 frames
 decoded;
   Input stream #0:1 (audio): 54 packets read (433152 bytes); 54 frames
 decoded (54144 samples);
   Input stream #0:2 (data): 0 packets read (0 bytes);
   Total: 88 packets (4069961 bytes) demuxed
 Output file #0 (incorrect-start-frame.mp4):
   Output stream #0:0 (video): 37 frames encoded; 37 packets muxed (1086294
 bytes);
   Output stream #0:1 (audio): 53 frames encoded (54144 samples); 54
 packets muxed (17850 bytes);
   Total: 91 packets (1104144 bytes) muxed
 86 frames successfully decoded, 0 decoding errors
 [AVIOContext @ 0x7fafe140c5a0] Statistics: 60 seeks, 154 writeouts
 [aac @ 0x7fafe1813c00] Qavg: 193.488
 [AVIOContext @ 0x7fafe1600560] Statistics: 4130879 bytes read, 2 seeks
 }}}

 Here is the relevant duration and start from the input incorrect-start-
 frame.mov:

 {{{
 % ffprobe incorrect-start-frame.mov 2>&1 | grep Duration
   Duration: 00:00:00.70, start: 0.522533, bitrate: 46718 kb/s
 }}}

 And here is the relevant duration and start from the output incorrect-
 start-frame.mp4:

 {{{
 % ffprobe incorrect-start-frame.mp4 2>&1 | grep Duration
   Duration: 00:00:01.24, start: 0.021313, bitrate: 7167 kb/s
 }}}

 Aside from the duration mismatch, the problem with the incorrect start
 frame is easy to see when viewing the input and output files.

--
Ticket URL: <https://trac.ffmpeg.org/ticket/5120#comment:2>
FFmpeg <https://ffmpeg.org>
FFmpeg issue tracker


More information about the FFmpeg-trac mailing list