I have a video file in which the audio is delayed by about 4 seconds. The audio starts too late.
I tried various things according to this post: https://forum.videohelp.com/threads/346293-Insert-Audio-Delay-With-ffmpeg :
- I tried to use avidemux, but no matter what value I enter in the delay box, the delay was STILL the same
- I tried to use the following command: `ffmpeg -i test.avi -itsoffset 4.0 -i test.avi -map 0:0 -map 1:1 -vcodec libx264 -r 25 -b:v 1268k -s 512x368 -acodec copy audio_delayed.mp4` but still the delay was the same!
- The only thing that worked more or less is to use kdenlive to split the audio and the video, shift it manually, repeat and repeat and render the video file taking almost 30 minutes of time. Its a 9 minute video, and all I want is to shift the audio wrt. the video...
Is there anything else I can try?
+ Reply to Thread
Results 1 to 10 of 10
-
-
I tried your command on a video that was oos by 500ms and it made no difference.
ffmpeg -i clip.mp4 -itsoffset 0.500 -i clip.mp4 -vcodec copy -acodec copy -map 0:0 -map 1:1 output_clip.mp4
ffmpeg -i clip.mp4 -itsoffset 0.500 -i clip.mp4 -vcodec copy -acodec copy -map 0:a -map 1:v output_clip.mp4 -
What I get is just audio without video! And when I reverse the mapping I have nothing...
Error message in the first case during playing (repeated hundred times or so):
missing marker bit!
MPEG: bad sequence header
and during the conversion with ffmpeg I seen thousand of buffer underflow errors...
I am also trying to use mpg file, maybe that play a role... -
Using your script with my offset and map values, I had no problem.
ffmpeg -i test.avi -itsoffset 0.5 -i test.avi -map 0:A -map 1:V -vcodec libx264 -r 25 -b:v 1268k -s 512x368 -acodec copy audio_delayed.mp4 -
I got immediately the following error:
[avi @ 0x3e4bf00] Invalid stream specifier: A.
Last message repeated 3 times
Stream map '0:A' matches no streams.
ffmpeg:
ffmpeg version N-80901-gfebc862 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --mandir=/usr/share/man --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libfreetype --enable-gnutls --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvidstab
libavutil 55. 28.100 / 55. 28.100
libavcodec 57. 48.101 / 57. 48.101
libavformat 57. 41.100 / 57. 41.100
libavdevice 57. 0.102 / 57. 0.102
libavfilter 6. 47.100 / 6. 47.100
libavresample 3. 0. 0 / 3. 0. 0
libswscale 4. 1.100 / 4. 1.100
libswresample 2. 1.100 / 2. 1.100
libpostproc 54. 0.100 / 54. 0.100
Hyper fast Audio and Video encoder -
Instead of using V and A in the command I used your line from the first post and reversed the map as shown below and it worked.
ffmpeg -i test.avi -itsoffset 4.0 -i test.avi -map 0:0 -map 1:1 -vcodec libx264 -r 25 -b:v 1268k -s 512x368 -acodec copy audio_delayed.mp4
ffmpeg -i test.avi -itsoffset 0.5 -i test.avi -map 0:1 -map 1:0 -vcodec libx264 -r 25 -b:v 1268k -s 512x368 -acodec copy audio_delayed.mp4 -
Thanks for your help, now the render command work. But the offset between video and audio is still present. I chose a 4 second value(!) but still the audio is way before the video. Also changing to -map 0:1 -map 1:0 did not change anything ...
-
This worked for me.
Audio leads video
This file bbt.mp4 stream map showed 0:0 video 0:1 audio
Add a positive value for audio adjustment (used mpc to get value)
offset 500 ms will be applied to second file listed on command line (second appearance of bbt.mp4)
On the command line...map now means something else :
map 0:0 means first listed file on command line - keep video
map 1:1 means second listed file on command line apply the offset to audio
ffmpeg -i bbt.mp4 -itsoffset 0.500 -i bbt.mp4 -vcodec copy -acodec copy -map 0:0 -map 1:1 output_bbt.mp4
Similar Threads
-
How to fix audio synch problem in AVI file
By vertical in forum Newbie / General discussionsReplies: 153Last Post: 20th Aug 2021, 06:45 -
Cannot fix audio sync issue with MPEG .ts file
By warp420 in forum Newbie / General discussionsReplies: 1Last Post: 8th Aug 2014, 05:33 -
Fixing white balance shift shift
By yardline in forum EditingReplies: 6Last Post: 11th Mar 2014, 15:51 -
Avidemux audio sync problems (shift doesn't fix it!!)
By awi1991 in forum Video ConversionReplies: 13Last Post: 20th Feb 2013, 11:49 -
How to fix audio sync issue in a wmv file
By pjbarbour in forum AudioReplies: 11Last Post: 20th Nov 2012, 14:29