(** NOTE: avconv was discontinued after Ubuntu 16.04 so this may not be helpful if you are running a later version. New post soon)
Here are my notes on how to convert video files between mp4 and other file types on Ubuntu. Especially between mp4 and mpg but avi and wmv can be used too.
There are a number of GUI converters in Linux but I’ve always found the command line converters the best. In fact most of the GUI solutions are just front ends on these command line driven converters. GUI tool winff isn’t bad but using command line tools (either avconf and ffmpeg) give you more options.
The reason I got involved with this was that some time back I was confronted with the problem that mp4 files did not play on my wifes Windows 10 box. I don’t know whether this has been changed now but at the time it was (I believe) Microsoft policy that mp4 files would not play by default.
How rubbish is that?
The result was I needed to convert video from perfectly good mp4 files into mpg and/or wmv file formats. Maybe there was a simpler windows solution. I don’t know. But this is what I did using my Ubuntu Linux distro.
Make sure you have winff, ffmpeg and lib-avtools installed
To convert using avconv (it’s part of the lib-avtools package) open a terminal. If you are in the Gnome GUI type Ctrl+Alt+t
In the terminal navigate to the directory holding your video files and then on command line type:
avconv -i my-mp4-file-name.mp4 -c:v mpeg2video my-mpg-file-name.mpg
NOTE the file name MUST NOT include a colon (:) like this file does
If there is a colon in the file-name avconv will fail with a strange obtuse warning like this:
MakeAPost-2019-05-22-12:07:45.mp4: Protocol not found
So make sure that the file-name does not have a colon. Notice above how the default time-stamp has been added when I recorded the video. This will break the conversion. Change it before you start.
To convert to wmv (which is twice the size and crap) You can use the GUI tool winff if you like. Or use avconv on the command line.
So by using avconv we can change file format but often we want to reduce the file size especially if we want to host it on our webspace. Next post will be how to reduce the size of videos files (here) and itemise some of the trade-offs that can be made.