Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Very noob when it comes to video. I'm trying to make sense of what I"m finding via Google... but its mostly Greek to me.

I have a bunch of Avi files that won't play in my WD TV Play box. Mediainfo tells me they are xvid. Specs for the box show that should be fine... but digging through forums says its hit-and-miss. So I'd like to try converting them to h264 encoded MKV or mp4 files.

I gather avconv is the tool, but reading the manual just has me really really confused.

I tried the very basic example of:

avconv -i file.avi -c copy file.mp4

it took less than 4 seconds. And it worked... sort of. It "played" in that something came up on the screen... but there was horrible artifacting and scenes would just sort of melt into each other. I want to preserve quality if possible.

I'm not concerned about file size. I'm not terribly concerned with the time it takes either, provided I can do them in a batch.

Can someone familiar with the process please give me a command with the options?

Thank you for your help.

I'm posting the mediainfo in case it helps:

Complete name                            : \\SERVER\Video\Public\test.avi
Format                                   : AVI
Format/Info                              : Audio Video Interleave
File size                                : 189 MiB
Duration                                 : 11mn 18s
Overall bit rate                         : 2 335 Kbps
Writing application                      : Lavf52.32.0

ID                                       : 0
Format                                   : MPEG-4 Visual
Format profile                           : Advanced Simple@L5
Format settings, BVOP                    : 2
Format settings, QPel                    : No
Format settings, GMC                     : No warppoints
Format settings, Matrix                  : Default (H.263)
Muxing mode                              : Packed bitstream
Codec ID                                 : XVID
Codec ID/Hint                            : XviD
Duration                                 : 11mn 18s
Bit rate                                 : 2 129 Kbps
Width                                    : 720 pixels
Height                                   : 480 pixels
Display aspect ratio                     : 16:9
Frame rate                               : 29.970 fps
Standard                                 : NTSC
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Compression mode                         : Lossy
Bits/(Pixel*Frame)                       : 0.206
Stream size                              : 172 MiB (91%)
Writing library                          : XviD 1.2.1 (UTC 2008-12-04)

ID                                       : 1
Format                                   : MPEG Audio
Format version                           : Version 1
Format profile                           : Layer 3
Mode                                     : Joint stereo
Mode extension                           : MS Stereo
Codec ID                                 : 55
Codec ID/Hint                            : MP3
Duration                                 : 11mn 18s
Bit rate mode                            : Constant
Bit rate                                 : 192 Kbps
Channel(s)                               : 2 channels
Sampling rate                            : 48.0 KHz
Compression mode                         : Lossy
Stream size                              : 15.5 MiB (8%)
Alignment                                : Aligned on interleaves
Interleave, duration                     : 24 ms (0.72 video frame)
share|improve this question

2 Answers 2

up vote 4 down vote accepted

The standard command from http://manpages.ubuntu.com/manpages/precise/man1/avconv.1.html shows this:

avconv -i test.avi -c:v libx264 -c:a copy outputfile.mp4

This will re-encode your video to h264 (=AVC) and keep your sound unchanged which is mp3 and completely legal to the standard.

A few other options to consider with this commandline are:

  • Tweak the quality of the output video by using the -b parameter (bitrate) or use Constant Rate Factor (CRF) with something like -crf 22
  • Use a libx264 preset such as -preset veryslow for improved video

If you use these the options should be placed after -c:v libx264 option...

You may also look at the GUI programs winff and avidemux which will make things less complicated. (also handbrake is a good one but i never came to terms with it )

share|improve this answer
Ha! I don't know how you look at that gobble-de-gook of a manpage and pull that line out as an obvious "standard command"... but I'm thankful that you did! It worked. I appreciate it. –  bcsteeve Nov 4 '13 at 14:42

Avidemux is a free video editor designed for simple cutting, filtering and encoding tasks. It supports many file types, including AVI, DVD compatible MPEG files, MP4 and ASF, using a variety of codecs. Tasks can be automated using projects, job queue and powerful scripting capabilities.Avidemux is available for Ubuntu.

sudo apt-get update
sudo apt-get install avidemux
share|improve this answer

Your Answer


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.