Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.


when I get a flash video from YouTube, why is the quality of the audio much worse than the origin video on YouTube? When I downloaded the flash movie, I convert it to avi like this:

   ffmpeg -i ~/"$2.flv" -sameq -acodec libmp3lame -vol 200 -ar 44100 -aq 300 -ab 2097152 ~/"$2.avi"

I already set -aq (audio quality) to 300, but no difference to 100 or 200. Moreover 100 is the max. value in my opinion. -ar (frequecy) 44100 should be ok too and the bitrate in bit/s (-ab) should be 256kb/s (2097152 / 1024 / 8). I am not sure what is the right bitrate for a good quality but I think 256kb/s should be fine. Or did I calculate it wrong?

What could be the problem?

share|improve this question
    
Is the avi audio worse that the one you download? or is it only worse than the one you play/watch in the browser.. (maybe you are downloading a video with lower quality than the one you watch in the browser)... I ran your command for several of my .flv clips and the sound was fine... What is the audio format of the downloaded file? Does it sound bad, or is it just out of sync? .. and what is the source bitrate? There is no value in upping the bitrate more than the origial quality.. it will only lose quality by re-encoding it. –  Peter.O Feb 12 '11 at 21:58
    
did you try to just copy the audio stream to the destination video? ffmpeg [...] -acodec copy [...] . To check if the input flv file has mp3 audio, ffmpeg -i. also, you can express bitrate in the 192k format if you prefer –  guido Feb 12 '11 at 21:59
    
@fred.bear. Actually one never knows what is the source bitrate or what is the audio format of the downloaded file. I just download it within a bash script using youtube-dl and the upper shown encoding. The sound is not out of sync but just bad. When I watch it in the browser on YouTube it sounds much better. –  Bevor Feb 13 '11 at 15:26
    
@guido. ...-acodec copy was a good proposal. The sound is as good as at the source but now I have another problem. I can't forward the avi anymore. Actually I can forward it but when I forward in mplayer to any position, the sound begins from new. That means that I can't forward the sound, so it is out of sync. –  Bevor Feb 13 '11 at 15:29
    
add: Obviously I don't have this weird problem in totem video player. An mplayer problem? Btw: Can you please post it as answer. –  Bevor Feb 13 '11 at 15:32
show 4 more comments

1 Answer

up vote 0 down vote accepted

This is the command line you want:

ffmpeg -i ~/test.flv -acodec libmp3lame -qscale 8 test.avi

Using the video you suggested as example i have almost the same quality in vlc as original (original has aac encoding).

You were specifying a way too high bitrate (2Mb/sec, 192kb/sec is far enough), i don't think it had any collateral effect on your command line though.

The difference is made by -qscale 8 which let ffmpeg output a VBR mp3 instead of a CBR stream.

share|improve this answer
    
Thanks for your reply. I used ffmpeg -i ~/"$2.flv" -acodec libmp3lame -qscale 8 -ab 196608 ~/"$2.avi" now and it sounds almost as good as the original. –  Bevor Feb 15 '11 at 20:16
add comment

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.