Better-quality FFMPEG conversion from MTS to AVI

8,275

MPEG-4 Part 2 video

When encoding to MPEG-4 Part 2 video using the encoders mpeg4 or libxvid use -qscale:v (or the alias -q:v).

ffmpeg -i input -c:v libxvid -qscale:v 2 -c:a libmp3lame -ac 2 -q:a 4 output.avi
  • Adjust -qscale:v for video quality and -q:a (similar to lame -V) for audio quality.

  • A lower value is a higher quality for both options. You may not be able to tell the difference between the input and output with -qscale:v 2.

Also see:

H.264 & H.265/HEVC video

MPEG-4 Part 2 video is outdated. Using a more modern format will provide better quality at lower bitrates.

Simple example assuming your ffmpeg has support for libx264/libx265 (it probably does):

ffmpeg -i input output.mp4

The above example will use the default setting which is the same as below:

ffmpeg -i input -c:v libx264 -crf 23 -preset medium -c:a aac -b:a 128k output.mp4
  • Avoid AVI if possible with these encoders.
  • Use AAC instead of MP3.

Also see:

Share:
8,275

Related videos on Youtube

Admin
Author by

Admin

Updated on September 18, 2022

Comments

  • Admin
    Admin almost 2 years

    I got the following code from some forum. I'm a beiginner, so please bear with my questions ...

    I need to convert a video from MTS to AVI in very good quality. Currently I'm using the following code for conversion.

    for %%a in ("*.mts") do ffmpeg.exe -i "%%a" -vcodec libxvid -vtag XVID -aspect 16:9 -maxrate 1800k -b 1500k -qmin 10 -qmax 42 -bufsize 5120  -acodec libmp3lame -ac 2 -ab 160k -y "%%~na_xvid.avi" 
    for %%a in ("*.m2ts") do ffmpeg.exe -i "%%a" -vcodec libxvid -vtag XVID -aspect 16:9 -maxrate 1800k -b 1500k -qmin 10 -qmax 42 -bufsize 5120 -acodec libmp3lame -ac 2 -ab 160k -y "%%~na_xvid.avi" 
    

    But I'm expecting better quality than the above. How do I get that?

    • tripleee
      tripleee about 12 years
      Can you quantify what you would regard as acceptable? How good is the input quality? What have you tried? Have you tried tweaking the quality-related options?
    • Chris Becke
      Chris Becke about 12 years
      Isn't the core issue here that you are using xvid? H.264 is widely used for compressing high quality HD video, but at SD resolutions compresses more than xvid for the same video quality.
    • Admin
      Admin about 12 years
      @ tripleee : I took Videos in Sony Digicam with HD quality and its in MTS.. I wanna Convert to AVI and want see the vidoes frame by frame.. So for that I need a HD Quality Ouput in AVI Format
    • Admin
      Admin about 12 years
      @ Chris Becke : Thanks Dude., But I'm New to this.. My requirement is, I need to convert HD Quality MTS file to HD Quality AVI, using FFMPEG... Can you guys provide me the coding to do this?? Thanks in Advance
  • evilsoup
    evilsoup over 11 years
    Note that you should only use this if you need to use an old hardware player that can't handle h.264 video+AAC audio in an MP4.