avconv converting videos in really bad quality

7,288

You can adjust the video quality using the -qscale flag for that command. Using -qscale 1 should provide the best quality and if you do not use this flag, the result is usually terrible quality. Try using this instead:

avconv -i video.mp4 -threads auto -qscale 1 -aq 1 video.ogg

I've also included a flag to optimize use of multiple threads and another to maximize audio quality.

Share:
7,288

Related videos on Youtube

Anonymous
Author by

Anonymous

Updated on September 18, 2022

Comments

  • Anonymous
    Anonymous over 1 year

    I have this linux command line app called avcon. It is used to converting files. For instance if I have a file called video.mp4 I can run avconv -i video.mp4 video.ogg and it will convert this video.mp4 to video.ogg.

    So my problem(question): Whenever it converts any file the output file's quality is super bad compared to the original video (the input video). How can I get around with that? I mean how can I convert the file and still get the same quality?

    If this is not possible using this app. Can anybody suggest anything else for converting video files using the command line?

  • Anonymous
    Anonymous almost 9 years
    What are these extra flags doing? Like: threads, aq ?
  • mchid
    mchid almost 9 years
    @Anonymous -aq is audio quality. Use 1 for the best audio quality. If it takes a really long time to convert the file, you could probably do it faster without the aq flag but audio may not be the best quality in the end. Next, a thread is a task run by a processor. If you have 2 physical cores using -threads 2 should optimum performance. However, if you want to limit system resources consumed by the process, you could limit it to one thread to use only one core to run the process but it will take longer. Setting it to auto is supposed to automatically choose the best option for you.
  • Anonymous
    Anonymous almost 9 years
    I ran this command but now there is no audio? Can you tell me what's wrong?
  • Anonymous
    Anonymous almost 9 years
    Ok! The audio is there but firefox is not playing the audio. Any help?
  • Anonymous
    Anonymous almost 9 years
    Hey @mchid I found this superuser.com/questions/353022/no-sound-in-html5-video . Can you please explain to me what is audio codec, libtheora etc. Please help me dude, I don't know shit about videos. But I need to convert it in my web app to produce cross browser html5 video.
  • mchid
    mchid almost 9 years
    @Anonymous Sure, just post another question. I will say that I believe libtheora should be the default for ogg. However, it looks like IE doesn't support ogg but as far as I know all major browsers support h.264 and mp4. Also, is there any specific reason you need to use ogg instead of mp4? I noticed the quality is really awful but I guess that is normal for ogg. However, using -qscale 1 for others like wmv and mkv the conversion from mp4 comes out great. As far as I know, mp4 should be able to stream html5, just look at youtube for example.
  • mchid
    mchid almost 9 years
    @Anonymous Try it out. Play the mp4 with firefox and it should play just fine.
  • mchid
    mchid almost 9 years
    @Anonymous for more info on theora see here en.wikipedia.org/wiki/Theora and here w3schools.com/html/html5_video.asp
  • mchid
    mchid almost 9 years
    @Anonymous here is a chart for the compatibility of different browser types en.wikipedia.org/wiki/Comparison_of_layout_engines_%28HTML5%‌​29
  • mchid
    mchid almost 9 years
    @Anonymous and here's one on lossy compression en.wikipedia.org/wiki/Lossy_compression
  • Anonymous
    Anonymous almost 9 years
    I need ogg because firefox won't play mp4 :(
  • mchid
    mchid almost 9 years
    @Anonymous do you have the latest version of firefox installed? The newest version of firefox should come with cisco h264. Also, you may need to go to about:config, search "mp4" and at the very least, enable the one for ffmpeg, the one for mediasource.
  • mchid
    mchid almost 9 years
    @Anonymous oh yeah, you may need to run sudo apt-get install gstreamer0.10-ffmpeg
  • Anonymous
    Anonymous almost 9 years
    You know what? I think its kinda messy. Even if I was able to convert it into ogg still many browsers won't support it. Is there a better way to host videos on your site instead of converting it after the upload? Can you give me any advice?
  • mchid
    mchid almost 9 years
    @Anonymous I can give you what I know but we really shouldn't be using comments to do this. You should ask that as a question and get answers from the whole community on this particular matter. Also, I would recommend possibly installing ubuntu 15.04 because 15.04 and newer versions of ubuntu have the real ffmpeg and not just avconv. The real ffmpeg seems to work a lot better right now.
  • Anonymous
    Anonymous almost 9 years
  • Zurd
    Zurd almost 6 years
    No avconv is from 1 (highest quality) to 31 (worst): libav.org/avconv.html