2

I have a MKV video file. The audio track is ac3. I extracted the AC3 and now want to convert it to Flac. But I need to add a delay/offset of 150ms. The offset should be permanent; the actual duration of the resulting Flac should be 150ms longer than the Ac3 input.

What is the command line to do this?

Thank you in advance.

2 Answers 2

5

I would do it with SoX (Sound eXchange) and ffmpeg (or avconv instead of ffmpeg). SoX is "the Swiss Army knife of audio manipulation", an effects and audio manupilation & generation tool for the command line.

Install both:

sudo apt-get install sox ffmpeg

Convert your ac3 file to a wave file. Since SoX cannot read ac3 files directly, this step is unfortunately required:

ffmpeg -i sound.ac3 sound.wav

Use SoX with the pad switch to insert silence at the beginning:

sox sound.wav sound.flac pad 0.150

This inserts 150ms of silence at the beginning of the audio file.

Look at the SoX Manual for more infos.

You can also do this in a single line, without the need for creating an intermediate wav file, by using a pipe:

ffmpeg -i sound.ac3 -f wav - | sox - sound.flac pad 0.150
0

MediaCoder should be able to handle that.

Do you want to remux the FLAC into the MKV? Otherwise I don't understand why you'd be concerned about the delay.

1
  • Only works with wine
    – damien
    Sep 22, 2012 at 0:01

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .