[libav-bugs] [Bug 751] New: Audio drifts out of sync when it's extracted and readded.

bugzilla at libav.org bugzilla at libav.org
Sun Sep 28 01:15:35 CEST 2014


https://bugzilla.libav.org/show_bug.cgi?id=751

           Summary: Audio drifts out of sync when it's extracted and
                    readded.
           Product: Libav
           Version: 0.8
          Platform: All
        OS/Version: Linux
            Status: NEW
          Severity: enhancement
          Priority: Normal
         Component: utilities
        AssignedTo: bugzilla at libav.org
        ReportedBy: forlibavbugzilla at calmarius.net


I'm using the avconv came with the default ubuntu distribution.

I recorded videos using DosBox I converted the to MKV by simply using:

$ avconv -i "part$I.avi" -vcodec libx264 -acodec copy -s vga "part$I""_tc.mkv"

(it runs in a loop). So they are all in the same format.

I merged them together with mkvmerge, so I have an single MKV I created by
merging lots of MKV files together. It plays fine in the Ubuntu's Totem player. 

I wanted to change the audio of it. So I extracted the audio track edited it,
and added it back using the commands:

$ avconv -i "intermediate_cc.mkv" -f wav "intermediate_fx.wav"

I edited the wav but I don't need to do anything with it, copying is fine:

$ cp intermediate_fx.wav final.wav

$ avconv -i final.wav -i intermediate_cc.mkv -map 0:0 -map 1:0 -c copy
-shortest final.mkv

Even if I don't edited the wav, the result plays fine at the beginning. But the
audio and the video gradually drifts away: audio heard earlier, the video comes
later.

I made the intermediate video by concatenating 46 tiny MKV videos together
using mkvmerge. I didn't noticed too much drift when there are fewer videos,
maybe 2-4.

Verbose logs:

$ avconv -v 9 -loglevel 99 -i intermediate_cc.mkv
avconv version 0.8.16-4:0.8.16-0ubuntu0.12.04.1, Copyright (c) 2000-2014 the
Libav developers
  built on Sep 16 2014 18:33:49 with gcc 4.6.3
  configuration: --extra-version='4:0.8.16-0ubuntu0.12.04.1' --arch=amd64
--prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --enable-vdpau --enable-bzlib
--enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora
--enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx
--enable-runtime-cpudetect --enable-libfreetype --enable-vaapi --enable-gpl
--enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394
--shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
  avutil      configuration: --extra-version='4:0.8.16ubuntu0.12.04.1'
--arch=amd64 --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --enable-vdpau
--enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex
--enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib
--enable-libvpx --enable-runtime-cpudetect --enable-libfreetype --enable-vaapi
--enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale
--enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp
--enable-libx264 --enable-libxvid --enable-libvo-aacenc --enable-version3
--enable-libvo-amrwbenc --enable-version3 --enable-libdc1394
--shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
  avcodec     configuration: --extra-version='4:0.8.16ubuntu0.12.04.1'
--arch=amd64 --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --enable-vdpau
--enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex
--enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib
--enable-libvpx --enable-runtime-cpudetect --enable-libfreetype --enable-vaapi
--enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale
--enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp
--enable-libx264 --enable-libxvid --enable-libvo-aacenc --enable-version3
--enable-libvo-amrwbenc --enable-version3 --enable-libdc1394
--shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
  libavutil    51. 22. 2 / 51. 22. 2
  libavcodec   53. 35. 0 / 53. 35. 0
  libavformat  53. 21. 1 / 53. 21. 1
  libavdevice  53.  2. 0 / 53.  2. 0
  libavfilter   2. 15. 0 /  2. 15. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  52.  0. 0 / 52.  0. 0
[matroska,webm @ 0x8209c0] Probed with size=2048 and score=100
st:0 removing common factor 1000000 from timebase
st:1 removing common factor 1000000 from timebase
[h264 @ 0x827080] err{or,}_recognition separate: 1; 1
[h264 @ 0x827080] err{or,}_recognition combined: 1; 1
[h264 @ 0x827080] Unsupported bit depth: 0
[pcm_s16le @ 0x8311a0] err{or,}_recognition separate: 1; 1
[pcm_s16le @ 0x8311a0] err{or,}_recognition combined: 1; 1
[h264 @ 0x827080] no picture
[matroska,webm @ 0x8209c0] All info found
[matroska,webm @ 0x8209c0] Estimating duration from bitrate, this may be
inaccurate
Input #0, matroska,webm, from 'intermediate_cc.mkv':
  Metadata:
    ENCODER         : Lavf53.21.1
  Duration: 00:09:01.71, start: 0.000000, bitrate: N/A
    Stream #0.0, 42, 1/1000: Video: h264 (Main), yuv420p, 640x480,
15625/2190197, PAR 1:1 DAR 4:3, 70.09 fps, 70.09 tbr, 1k tbn, 140.17 tbc
(default)
    Stream #0.1, 8, 1/1000: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411
kb/s (default)
At least one output file must be specified

The second command's verbose log:

$ avconv -v 9 -loglevel 99 -i intermediate_fx.wav -i intermediate_cc.mkv -map
0:0 -map 1:0 -c copy -shortest final.mkv
avconv version 0.8.16-4:0.8.16-0ubuntu0.12.04.1, Copyright (c) 2000-2014 the
Libav developers
  built on Sep 16 2014 18:33:49 with gcc 4.6.3
  configuration: --extra-version='4:0.8.16-0ubuntu0.12.04.1' --arch=amd64
--prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --enable-vdpau --enable-bzlib
--enable-libgsm --enable-libschroedinger --enable-libspeex --enable-libtheora
--enable-libvorbis --enable-pthreads --enable-zlib --enable-libvpx
--enable-runtime-cpudetect --enable-libfreetype --enable-vaapi --enable-gpl
--enable-postproc --enable-swscale --enable-x11grab --enable-libdc1394
--shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
  avutil      configuration: --extra-version='4:0.8.16ubuntu0.12.04.1'
--arch=amd64 --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --enable-vdpau
--enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex
--enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib
--enable-libvpx --enable-runtime-cpudetect --enable-libfreetype --enable-vaapi
--enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale
--enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp
--enable-libx264 --enable-libxvid --enable-libvo-aacenc --enable-version3
--enable-libvo-amrwbenc --enable-version3 --enable-libdc1394
--shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
  avcodec     configuration: --extra-version='4:0.8.16ubuntu0.12.04.1'
--arch=amd64 --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --enable-vdpau
--enable-bzlib --enable-libgsm --enable-libschroedinger --enable-libspeex
--enable-libtheora --enable-libvorbis --enable-pthreads --enable-zlib
--enable-libvpx --enable-runtime-cpudetect --enable-libfreetype --enable-vaapi
--enable-libopenjpeg --enable-gpl --enable-postproc --enable-swscale
--enable-x11grab --enable-libdirac --enable-libmp3lame --enable-librtmp
--enable-libx264 --enable-libxvid --enable-libvo-aacenc --enable-version3
--enable-libvo-amrwbenc --enable-version3 --enable-libdc1394
--shlibdir=/usr/lib/x86_64-linux-gnu --enable-shared --disable-static
  libavutil    51. 22. 2 / 51. 22. 2
  libavcodec   53. 35. 0 / 53. 35. 0
  libavformat  53. 21. 1 / 53. 21. 1
  libavdevice  53.  2. 0 / 53.  2. 0
  libavfilter   2. 15. 0 /  2. 15. 0
  libswscale    2.  1. 0 /  2.  1. 0
  libpostproc  52.  0. 0 / 52.  0. 0
[wav @ 0x1a509c0] Probed with size=2048 and score=99
[pcm_s16le @ 0x1a529a0] err{or,}_recognition separate: 1; 1
[pcm_s16le @ 0x1a529a0] err{or,}_recognition combined: 1; 1
[wav @ 0x1a509c0] max_analyze_duration reached
Input #0, wav, from 'intermediate_fx.wav':
  Duration: 00:09:00.79, bitrate: 1411 kb/s
    Stream #0.0, 218, 1/44100: Audio: pcm_s16le, 44100 Hz, 2 channels, s16,
1411 kb/s
[matroska,webm @ 0x1af59e0] Probed with size=2048 and score=100
st:0 removing common factor 1000000 from timebase
st:1 removing common factor 1000000 from timebase
[h264 @ 0x1b492e0] err{or,}_recognition separate: 1; 1
[h264 @ 0x1b492e0] err{or,}_recognition combined: 1; 1
[h264 @ 0x1b492e0] Unsupported bit depth: 0
[pcm_s16le @ 0x1b4d4c0] err{or,}_recognition separate: 1; 1
[pcm_s16le @ 0x1b4d4c0] err{or,}_recognition combined: 1; 1
[h264 @ 0x1b492e0] no picture
[matroska,webm @ 0x1af59e0] All info found
[matroska,webm @ 0x1af59e0] Estimating duration from bitrate, this may be
inaccurate
Input #1, matroska,webm, from 'intermediate_cc.mkv':
  Metadata:
    ENCODER         : Lavf53.21.1
  Duration: 00:09:01.71, start: 0.000000, bitrate: N/A
    Stream #1.0, 42, 1/1000: Video: h264 (Main), yuv420p, 640x480,
15625/2190197, PAR 1:1 DAR 4:3, 70.09 fps, 70.09 tbr, 1k tbn, 140.17 tbc
(default)
    Stream #1.1, 8, 1/1000: Audio: pcm_s16le, 44100 Hz, 2 channels, s16, 1411
kb/s (default)
File 'final.mkv' already exists. Overwrite ? [y/N]

-- 
Configure bugmail: https://bugzilla.libav.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are watching all bug changes.


More information about the libav-bugs mailing list