In response to your update: depending on how you're downloading the video, you may not be getting the best quality version that YouTube is hosting. If you're using clive (or cclive), -f best
will get the best it can.
If you want to reliably not lose any data when pulling audio out of a video file, convert it to .wav or ensure you're not re-encoding.
The final line in the output log is too generic — you'll have to look up further. The error is this:
[ac3 @ 0x9fdc740] invalid bit rate
The problem is that for some reason avconv wants to encode your MP3 audio to AC3. In fact, when you're only resizing video, you can leave the audio bitstream alone.
Note that resizing and re-encoding will lower your quality drastically. So, unless you really need to, don't do it. Your video will suffer from generation loss.
If you can, avoid using MPEG-4 Part 2 codecs (Xvid, or the libavcodec-native mpeg4
), and use MPEG-4 Part 10 / H.264 codecs instead (e.g., x264). Since H.264 isn't properly supported in AVI containers, we'll use MP4 instead, which should be your container of choice instead of AVI most of the time.
ffmpeg -i in.avi -c:a copy -c:v libx264 -crf 23 -s:v 640x360 output.mp4
This will copy the audio stream (-c:a copy
), encode the video to x264 (-c:v libx264
) with a constant quality of 23 (-crf
). Use a lower value here for better quality (with sane values from 18–28). The size will be changed with -s:v
.
I'm using FFmpeg synonymously with Libav here, since the syntax should be the same. I would however recommend you to ditch the default Libav version that ships with Ubuntu and compile FFmpeg from source or use a recent Linux static build.
Best Answer
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 likesox
to do the audio part(adjust mapping depending on streams):There is surely a simpler way to do this but I've tried with some random .mkv file and it worked.