avconv is a utility that belongs to Libav project. Similar to its precedent
ffmpeg, it supports lots of mainstream encoders and decoders. Here I just put some simple commands as a personal memo and a brief guide.
apt-get on your Debian/Ubuntu machines. Note on my Fedora laptop, there is no
libav but only the original
ffmpeg packages. The command-line options are fairly similar (sometimes even identical). In that case, you only need to substitute
Some media players don’t recognize MKV files but only MP4 files. It’s not just an extension name! For example, the SONY PS3 can’t play MKV files. You can’t just rename a MKV file as MP4 because they’re two different containers.
If this is the only thing we need, the converting would be very fast! (because we won’t decode and encode streams). Type
avconv -i INPUT_FILE -c copy OUTPUT_FILE in your terminal and just wait for a few minutes. i.e.
avconv -i demo.mkv -c copy demo.mp4
It’ll take longer time than previous one because of the decoding and encoding thing. Much longer if you change the video format rather than audio format.
Change Video Format
avconv -i INPUT_FILE -c:v h264 -c:a copy OUTPUT_FILE to convert the video stream in INPUT_FILE to H.264 format and copy the audio stream and store them in the OUTPUT_FILE.
Change Audio Format
avconv -i INPUT_FILE -c:v copy -c:a aac OUTPUT_FILE to convert the audio stream in
INPUT_FILE to AAC format and copy the video stream and store them in the
Change Both Video and Audio Formats
As you can see, you need to give new formats for video and audio by
-c:a respectively. The
copy is a special keyword which means instead of decode then encode, just copy.
- To see the codec information about a media file, just type
avconv -i INPUT_FILE.
- To see what codecs avconv supports, type
- The command-option for subtitle is
-scodecin old syntax.
- The old syntax for video codec and audio codec are