5

As noted here, we could speedup audio with ffmpeg using:

$ ffmpeg -i input.mkv -filter:a "atempo=2.0" -vn output.mkv

But on Ubuntu, ffmpeg is replaced by avconv, and the atempo filter is not available in avconv.

My question is:

  1. Are there any alternatives to the atempo filter to use with avconv, or how to speed up audio AND video using avconv?
  2. How to speed up a video file (if you have better ideas)?
2
  • @illuminÉ By video, I mean video with sound, usually when you speedup a video, I'd expect the sound also keeps up with the video. Jul 4, 2014 at 22:42
  • 1
    @illuminÉ Thanks. I will look into sox. Currently I add ppa for ffmpeg. I'm a newbie to video/audio editing :D Jul 4, 2014 at 23:02

2 Answers 2

5

It is possible to circumvent the fact that the atempo filter is not available for avconv(yet the setpts video filter is). Simply use another tool like sox to do the audio part(adjust mapping depending on streams):

avconv -i input.mkv -c copy -map 0:0 video.raw                   #copy raw video stream
avconv -i input.mkv -c copy -map 0:1 audio.raw                   #copy raw audio stream
sox audio.raw audioq.raw speed 4                         #speed up(4x)audio&pitch
sox audio.raw audioq.raw tempo 4                         #or, to preserve pitch
avconv -i video.raw -filter:v "setpts=0.25*PTS" output.raw #speed up (4x) video
avconv -i output.raw -i audioq.raw final.mkv             #combine outputs to .mkv

There is surely a simpler way to do this but I've tried with some random .mkv file and it worked.

1
  • if you use 'sox tempo', the '-m' or '-s' flags should give a better quality. as noted here, these calculate an appropriate "segment" for music or speech.
    – martz
    Dec 21, 2016 at 11:57
4

Rater than use avconv why not just switch to ffmpeg instead. The project offers a statically built version which you can simply download and install + use in place.

Once downloaded and unpacked you can run it like so:

./ffmpeg ....
3
  • @illuminÉ Actually you could work around this limitation by using -filter_complex to chain the speedup. I think ffmepg online manual mentioned that :) Jul 5, 2014 at 12:36
  • I actually added the PPA for ffmpeg. Thanks though :D Jul 5, 2014 at 12:37
  • @gongzhitaao Thanks for the heads up, I actually had not paid attention!:) Indeed, as I was saying it certainly is easier with ffmpeg! You're welcome!
    – user44370
    Jul 5, 2014 at 12:43

You must log in to answer this question.

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