Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an AC3 5.1 audio file to which I would like to insert x seconds of silent audio at the beginning. This has nothing to do with video muxing, so itsoffset is useless since it seems to only work with an audio stream accompanying a video one. I would like to achieve this with ffmpeg. Any ideas?

share|improve this question
    
ffmpeg will append or join same codec same rate things? – Psycogeek Apr 6 '13 at 19:14
    
I suppose... @Psycogeek – Makaveli84 Apr 6 '13 at 19:21
    
And is it capable of generating a silent audio file of the exact same codec rate and channel? ffmpeg.org/ffmpeg-filters.html#Examples-34 ? Myself I use GUI methods, but doing what your asking should be fairly easy and very fast, as long as the parameters are all the same. Here is where it is shown adding it to a Mov. stackoverflow.com/questions/12368151/… in the answers – Psycogeek Apr 6 '13 at 20:47
    
Use Ardour to add anything you want. If you want effects as well download the Calf plugins.. – dashboard Apr 6 '13 at 21:25

You can use the anullsrc audio source filter in ffmpeg. Example to make a 5.1 channel, 48000 Hz sample rate, 1 second silent audio file:

ffmpeg -f lavfi -i anullsrc=channel_layout=5.1:sample_rate=48000 -t 1 silence.ac3

Now you can concatenate the files using the concat protocol:

ffmpeg -i concat:"silence.ac3|audio.ac3" -codec copy combined.ac3

Or you can do everything in one command with the concat filter:

ffmpeg -f lavfi -i anullsrc=channel_layout=5.1:sample_rate=48000 -i audio.ac3 -filter_complex \
"[0:0] [1:0] concat=n=2:v=0:a=1" combined.ac3

Using the concat filter will result in re-encoding, while the concat protocol will not.

share|improve this answer
4  
[Parsed_aevalsrc_0 @ 000000000195fec0] This syntax is deprecated. Use '|' to sep arate the list items. New syntax is -i "aevalsrc=0|0|0|0|0|0:d=1" – Steven Penny Mar 2 '14 at 19:24

Do it the easy way using Audacity. Import your audio file into Audacity, click in the audio track where you want to insert your silence, and from the Audacity menu select Generate -> Silence. You can see this illustrated in more detail here.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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