Converting videos with avconv on Linux

 IT, Linux  Kommentare deaktiviert für Converting videos with avconv on Linux
Jul 022014
 

The videos produces by my action cam are stored as *.mov files. These files are very large, so I wanted them to be converted to a better format (using a better container/codec). Ubuntu earlier provided a package named ffmpeg. This package was replaced by libav. Libav uses the codebase of ffmpeg. The installation of libav provides some tools for audio and video streams.

One ff these tools is avconv which converts audio and video files. To convert a file from mov to mpg4 you can use:

avconv -i myfile.mov -vcodec mpeg4 -acodec copy myfile.mp4

This will convert the video to mpeg4 and copy the audio stream. For my purpose I used the h264 codec. This codec is still under development because of some problems when using it for audio streams (also for audio streams in videos). Because I would like to remove the audio stream (the sound of my action cam is very bad) this codec is fine for me.

To convert a MOV file to mp4 using h264 codec (and removing the audio stream) you can use the following command:

avconv -i myfile.mov -vcodec h264 -an myfile.mp4

The parameter „-an“ will remove the audio stream from the video.

The file size of the generated mp4 file is round about just 1/4 of the origin mov file, but the quality is nearly the same.