[FFmpeg-user] How to change audio stream offset

Francois Visagie francois.visagie at gmail.com
Thu Sep 5 09:33:49 CEST 2013


Hi All,

 

I'm getting a few cases where only ffmpeg correctly understand the AV sync
in its mp4 output, in the sense that other applications play audio too early
wrt. video. I'm trying to correct that after encoding with '-itsoffset' but
not having much luck. The offset between audio and video remains unchanged.

 

I'll be grateful for any suggestions to help fix this.

 

Here's the command line as well as console output; in this case audio needs
to be delayed by 650ms (I assume that '-itsoffset' applies to the next
specified input file?):

 

C:\Users\fvisagie\Videos\My DVDs\MainMovie\Neil Diamond Live at the
Greek\VIDEO_TS>ffmpeg -i "Neil Diamond Live at the Greek.mp4" -itsoffset
00:00:00.650 -i "Ne

il Diamond Live at the Greek.mp4" -map 0:v -map 1:a -c: copy zzz.mp4

ffmpeg version N-55159-gf118b41 Copyright (c) 2000-2013 the FFmpeg
developers

  built on Aug  1 2013 18:01:57 with gcc 4.7.3 (GCC)

  configuration: --enable-gpl --enable-version3 --disable-w32threads
--enable-avisynth --enable-bzlib --enable-fontconfig --enable-frei0r
--enable-gnutls --enab

le-iconv --enable-libass --enable-libbluray --enable-libcaca
--enable-libfreetype --enable-libgsm --enable-libilbc --enable-libmodplug
--enable-libmp3lame --ena

ble-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg
--enable-libopus --enable-librtmp --enable-libschroedinger --enable-libsoxr
--enable-libsp

eex --enable-libtheora --enable-libtwolame --enable-libvo-aacenc
--enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libx264
--enable-libxavs --

enable-libxvid --enable-zlib

  libavutil      52. 40.100 / 52. 40.100

  libavcodec     55. 19.100 / 55. 19.100

  libavformat    55. 12.102 / 55. 12.102

  libavdevice    55.  3.100 / 55.  3.100

  libavfilter     3. 82.100 /  3. 82.100

  libswscale      2.  4.100 /  2.  4.100

  libswresample   0. 17.103 /  0. 17.103

  libpostproc    52.  3.100 / 52.  3.100

Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'Neil Diamond Live at the
Greek.mp4':

  Metadata:

    major_brand     : isom

    minor_version   : 512

    compatible_brands: isomiso2avc1mp41

    encoder         : Lavf55.10.100

  Duration: 00:47:55.14, start: 0.000000, bitrate: 1136 kb/s

    Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
640x480 [SAR 1:1 DAR 4:3], 999 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94
tbc

    Metadata:

      handler_name    : VideoHandler

    Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo,
fltp, 128 kb/s

    Metadata:

      handler_name    : SoundHandler

Input #1, mov,mp4,m4a,3gp,3g2,mj2, from 'Neil Diamond Live at the
Greek.mp4':

  Metadata:

    major_brand     : isom

    minor_version   : 512

    compatible_brands: isomiso2avc1mp41

    encoder         : Lavf55.10.100

  Duration: 00:47:55.14, start: 0.000000, bitrate: 1136 kb/s

    Stream #1:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p,
640x480 [SAR 1:1 DAR 4:3], 999 kb/s, 29.97 fps, 29.97 tbr, 30k tbn, 59.94
tbc

    Metadata:

      handler_name    : VideoHandler

    Stream #1:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo,
fltp, 128 kb/s

    Metadata:

      handler_name    : SoundHandler

Output #0, mp4, to 'zzz.mp4':

  Metadata:

    major_brand     : isom

    minor_version   : 512

    compatible_brands: isomiso2avc1mp41

    encoder         : Lavf55.12.102

    Stream #0:0(und): Video: h264 ([33][0][0][0] / 0x0021), yuv420p, 640x480
[SAR 1:1 DAR 4:3], q=2-31, 999 kb/s, 29.97 fps, 30k tbn, 30k tbc

    Metadata:

      handler_name    : VideoHandler

    Stream #0:1(und): Audio: aac ([64][0][0][0] / 0x0040), 48000 Hz, stereo,
128 kb/s

    Metadata:

      handler_name    : SoundHandler

Stream mapping:

  Stream #0:0 -> #0:0 (copy)

  Stream #1:1 -> #0:1 (copy)

Press [q] to stop, [?] for help

frame=86168 fps=2755 q=-1.0 Lsize=  398745kB time=00:47:55.77
bitrate=1135.9kbits/s

video:350816kB audio:44989kB subtitle:0 global headers:0kB muxing overhead
0.742980%

 

Many thanks in advance,

Francois

 

Francois Visagie

 

 

T: +27 (83) 326-4358

F: +27 (86) 511-3490

E: francois.visagie at gmail.com

 

 



More information about the ffmpeg-user mailing list