Showing posts with label video coversion. Show all posts
Showing posts with label video coversion. Show all posts

Thursday, May 17, 2012

Video conversion in Linux

My Nikon COOLPIX P300 camera generates h264, 1920x1080 videos in a .mov container. So a 17 second video is over 40 Megabytes. I decided to convert this to a different format, with the aim of reducing the file size.

A quick search led me to ffmpeg. Running that dispalyed a message to use avconv instead.

So on to avconv.

To do a basic conversion, the command is:

avconv -i in_movie.mov out_movie.avi

This however failed with:

[ac3 @ 0x875efa0] invalid bit rate

Turns out, the default bitrate used by avconv is not supported by the default audio codec ( ac3 ) it selected. Sigh.


Solution,  modify the command to use 192k audio bitrate which it support.

avconv -i in_movie.mov -b:a 192k out_movie.avi

This worked. It generated a 3 Megabyte file, which seemed impressive, but the quality sucked since it reduced the video bit rate dramatically.

I decided to move the video bit rate closer to the original video. So the command with video bitrate set to 19000 kbps is

avconv -i in_movie.mov -b 19000k -b:a 192k -out_movie.avi

This got me good video quality but it only reduced the file size by a few Megabytes.

I decided the best reduce the resolution by 1/2 to get a lower file size with good quality video.  That command is

avconv -i in_movie.mov -b 19000k -b:a 192k -s 960x540 out_movie.avi

This reduced the 40+ Megabyte file to a 12 Megabyte file.  Success.