Opened 11 years ago

Last modified 11 years ago

#3201 new defect

A/V desync without -async 1

Reported by: Carl Eugen Hoyos Owned by:
Priority: normal Component: undetermined
Version: git-master Keywords:
Cc: Blocked By:
Blocking: Reproduced by developer: no
Analyzed by developer: no

Description

I "fixed" the sample from ticket #3195 with a hex editor to allow testing with MPlayer and older FFmpeg versions.
The sample plays fine (no A/V desync) with at least FFplay, MPlayer and vlc, transcoding with FFmpeg leads to a file with severe desync if -async 1 was not used.
out.avi shows A/V desync:

$ ffmpeg -i detect_aac.mpg -qscale 2 out.avi
ffmpeg version N-58799-g5ac5581 Copyright (c) 2000-2013 the FFmpeg developers
  built on Dec  6 2013 10:16:53 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      52. 56.100 / 52. 56.100
  libavcodec     55. 45.100 / 55. 45.100
  libavformat    55. 22.100 / 55. 22.100
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     3. 91.100 /  3. 91.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
[aac @ 0x19127a0] get_buffer() failed
Input #0, mpeg, from 'detect_aac.mpg':
  Duration: 00:00:31.10, start: 0.000000, bitrate: 19585 kb/s
    Stream #0:0[0x1e0]: Video: h264 (Main), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn, 60 tbc
    Stream #0:1[0x1c0]: Audio: aac, 44100 Hz, stereo, fltp, 134 kb/s
Please use -q:a or -q:v, -qscale is ambiguous
Output #0, avi, to 'out.avi':
  Metadata:
    ISFT            : Lavf55.22.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 30 tbn, 30 tbc
    Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 44100 Hz, stereo, fltp, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mpeg4)
  Stream #0:1 -> #0:1 (aac -> ac3)
Press [q] to stop, [?] for help
[aac @ 0x19127a0] Input buffer exhausted before END element found
Error while decoding stream #0:1: Invalid data found when processing input
frame=  903 fps=160 q=2.0 Lsize=  103095kB time=00:00:31.13 bitrate=27126.9kbits/s
video:102338kB audio:704kB subtitle:0 global headers:0kB muxing overhead 0.051418%

Works fine with -async 1

$ ffmpeg -i detect_aac.mpg -async 1 -qscale 2 outasync.avi
ffmpeg version N-58799-g5ac5581 Copyright (c) 2000-2013 the FFmpeg developers
  built on Dec  6 2013 10:16:53 with gcc 4.7 (SUSE Linux)
  configuration: --enable-gpl
  libavutil      52. 56.100 / 52. 56.100
  libavcodec     55. 45.100 / 55. 45.100
  libavformat    55. 22.100 / 55. 22.100
  libavdevice    55.  5.102 / 55.  5.102
  libavfilter     3. 91.100 /  3. 91.100
  libswscale      2.  5.101 /  2.  5.101
  libswresample   0. 17.104 /  0. 17.104
  libpostproc    52.  3.100 / 52.  3.100
[aac @ 0x21067a0] get_buffer() failed
Input #0, mpeg, from 'detect_aac.mpg':
  Duration: 00:00:31.10, start: 0.000000, bitrate: 19585 kb/s
    Stream #0:0[0x1e0]: Video: h264 (Main), yuv420p(tv), 1920x1080 [SAR 1:1 DAR 16:9], 30 fps, 30 tbr, 90k tbn, 60 tbc
    Stream #0:1[0x1c0]: Audio: aac, 44100 Hz, stereo, fltp, 134 kb/s
Please use -q:a or -q:v, -qscale is ambiguous
-async is forwarded to lavfi similarly to -af aresample=async=1:min_hard_comp=0.100000:first_pts=0.
Output #0, avi, to 'outasync.avi':
  Metadata:
    ISFT            : Lavf55.22.100
    Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 30 tbn, 30 tbc
    Stream #0:1: Audio: ac3 ([0] [0][0] / 0x2000), 44100 Hz, stereo, fltp, 192 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (h264 -> mpeg4)
  Stream #0:1 -> #0:1 (aac -> ac3)
Press [q] to stop, [?] for help
[aac @ 0x21067a0] Input buffer exhausted before END element found
Error while decoding stream #0:1: Invalid data found when processing input
frame=  903 fps=161 q=2.0 Lsize=  103119kB time=00:00:31.13 bitrate=27133.4kbits/s
video:102338kB audio:728kB subtitle:0 global headers:0kB muxing overhead 0.051406%

Change History (1)

Note: See TracTickets for help on using tickets.