Opened 7 years ago

Closed 6 years ago

#6487 closed defect (fixed)

Transcoding h.264 mp4 file from Canon C100 leads to a/v desync

Reported by: rmk Owned by:
Priority: important Component: avformat
Version: git-master Keywords: mov h264 regression
Cc: Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: no

Description

Summary of the bug:

Camera files of this type from the Canon C100, transcoded by ffmpeg result in a two-frame a/v offset in the created files, regardless of output codec.

Quick analysis looks like there's simply something wrong in the timestamps of the decoded video frames. While in the packet timestamps the PTS for first packet (in display order) is 0 for audio and video, in the decoded frames it is 2002 for video and 0 for audio which makes ffmpeg duplicate the first frame twice to fill the gap of two frames.

I will upload the sample.

How to reproduce (with full command line output):

ffmpeg -i MVI_0312.MP4 -vcodec mjpeg ~/tmp/ffmpeg-out.mov 
ffmpeg version N-86581-ge5bce8b4ce Copyright (c) 2000-2017 the FFmpeg developers
  built with Apple LLVM version 8.1.0 (clang-802.0.42)
  configuration: 
  libavutil      55. 66.100 / 55. 66.100
  libavcodec     57. 99.100 / 57. 99.100
  libavformat    57. 73.100 / 57. 73.100
  libavdevice    57.  7.100 / 57.  7.100
  libavfilter     6. 94.100 /  6. 94.100
  libswscale      4.  7.101 /  4.  7.101
  libswresample   2.  8.100 /  2.  8.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'MVI_0312.MP4':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp42avc1CAEP
    creation_time   : 2017-06-13T19:42:42.000000Z
    timecode        : 17:07:33:05
  Duration: 00:00:02.00, start: 0.000000, bitrate: 25030 kb/s
    Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 23728 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 48k tbc (default)
    Metadata:
      creation_time   : 2017-06-13T19:42:42.000000Z
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 252 kb/s (default)
    Metadata:
      creation_time   : 2017-06-13T19:42:42.000000Z
    Stream #0:2(eng): Data: none (tmcd / 0x64636D74), 0 kb/s (default)
    Metadata:
      creation_time   : 2017-06-13T19:42:42.000000Z
      timecode        : 17:07:33:05
Stream mapping:
  Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
  Stream #0:1 -> #0:1 (aac (native) -> aac (native))
Press [q] to stop, [?] for help
[swscaler @ 0x7fbb240d4e00] deprecated pixel format used, make sure you did set range correctly
Output #0, mov, to '/Users/krueger/tmp/ffmpeg-out.mov':
  Metadata:
    major_brand     : mp42
    minor_version   : 1
    compatible_brands: mp42avc1CAEP
    timecode        : 17:07:33:05
    encoder         : Lavf57.73.100
    Stream #0:0(eng): Video: mjpeg (jpeg / 0x6765706A), yuvj420p(pc), 1920x1080, q=2-31, 200 kb/s, 23.98 fps, 24k tbn, 23.98 tbc (default)
    Metadata:
      creation_time   : 2017-06-13T19:42:42.000000Z
      encoder         : Lavc57.99.100 mjpeg
    Side data:
      cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
    Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 128 kb/s (default)
    Metadata:
      creation_time   : 2017-06-13T19:42:42.000000Z
      encoder         : Lavc57.99.100 aac
frame=   48 fps=0.0 q=24.8 Lsize=    3191kB time=00:00:01.98 bitrate=13174.3kbits/s dup=2 drop=0 speed=2.18x    
video:3155kB audio:33kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.091139%
[aac @ 0x7fbb22023400] Qavg: 1975.941

Change History (2)

comment:1 by rmk, 7 years ago

FTP does not seem to work. A sample file can be downloaded here: https://www.dropbox.com/s/1mqk4cbz2cv8gvf/MVI_0300.MP4?dl=0

comment:2 by Carl Eugen Hoyos, 6 years ago

Component: undeterminedavformat
Keywords: mov h264 regression added
Priority: normalimportant
Reproduced by developer: set
Resolution: fixed
Status: newclosed
Version: unspecifiedgit-master
Note: See TracTickets for help on using tickets.