0

I am using Ubuntu vivid on my laptop and I want to recompile audio and voice with delayed audio. Movie was late comparing to audio. I demuxed voice.aac and video.h264 from orginal video. I know that it is possible via editing aac but this file doesnt need any mod for aac. Just wanna delay audio.

1

The -itsoffset option should do what you want:

-itsoffset offset (input)

Set the input time offset.

offset must be a time duration specification, see (ffmpeg-utils) the Time duration section in the ffmpeg-utils(1) manual.

The offset is added to the timestamps of the input files. Specifying a positive offset means that the corresponding streams are delayed by the time duration specified in offset.

So

$ ffmpeg -i video.h264 -itsoffset 1.0 -i voice.aac -map 0:a -map 1:v -c copy remuxed.mp4

should give an audio delay of 1 second. However, there might be container issues here, since ffmpeg is having to figure everything out from scratch.

What's better is if you do it using the original file:

 $ ffmpeg -i orig.mkv -itsoffset 1.0 -i orig.mkv -map 0:a -map 1:v -c copy remuxed.mkv

This applies a delay of 1 second (per the option to -itsoffset) to input 0, and no delay to input 1. The -map options specify to take the (delayed) audio from input 0 and the (non-delayed) video from input 1.

Hope that's clearer!


(If you wanted to delay the video instead, change the -map options:

 $ ffmpeg -i orig.mkv -itsoffset 1.0 -i orig.mkv -map 0:v -map 1:a -c copy remuxed.mkv

which specifies to take the delayed video, and the non-delayed audio)

  • Man this is what I need. I will try it when I go to home – makgun Jul 1 '15 at 16:05
  • Hope it works- I haven't tested. You may need to transcode rather than mux, but hopefully not! – bertieb Jul 1 '15 at 16:15
  • 1
    @makgun The delay is specified as the option to -itsoffset, 1.0 for 1 second, 0.125 for and 8th of a second etc. I have updated the answer to clarify this. – bertieb Jul 1 '15 at 17:36
  • 1
    @bertleb thaks for usefull answer Ive learnt it as well. Now I can watch it without using special video player. – makgun Jul 1 '15 at 18:26
  • 1
    Glad you got the answer to work :) Remember you can mark an answer as accepted by clicking the grey tick- no pressure though! About rotating, it is better to ask that as a separate question to avoid extended discussion in comments :) – bertieb Jul 2 '15 at 8:15

Your Answer

By clicking "Post Your Answer", you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.