Compression to mpeg4 (former divx5) or webm
last update 20070225 20151115
Compressing films for internet release
Transcode preliminaries
Comparative chart
Transcode film_master.mov to mpeg4 [ffmpeg]
Notes re. compression to mpeg4 [divx]
Transcode preliminaries
Comparative chart
Transcode film_master.mov to mpeg4 [ffmpeg]
Notes re. compression to mpeg4 [divx]
Introduction
- Use of codec 'divx' to encode an mpeg4 compliant film is not recommended by the transcode man pages anymore, you should use 'ffmpeg' instead
- this is NOT a tutorial but a collection of favourite settings (flags / options) used when encoding (compressing) a video file.
- to find out more about the use of a piece of software and its options check man pages or respective web-sites:
-
www.transcoding.org - transcode
Compressing films for streaming
- Now (20151115) use ffmpeg or avconv to render *webm files for streaming
- Detailed instructions found at http://superuser.com/questions/556463/converting-video-to-webm-with-ffmpeg-avconv (Thx)
avconv -i master_rendered_by_cinelerra_quicktime4linux.mov \ -c:v libvpx -qmin 0 -qmax 50 -crf 10 -b:v 2M film_of_good_quality_for_streaming_wo_flash.webm avconv -i film_of_average_quality_2200mpeg2.mpg \ -c:v libvpx -qmin 5 -qmax 40 -crf 10 -b:v 1M film_of_average_quality_for_streaming_wo_flash.webm
Compressing films for internet release - DEPRECATED
- this section focuses on the compression of films for release on the internet; prime concern is not quality, but size
- to preserve a minimum of visual quality films are encoded for download and not streaming; given the growing popularity of watching videos directly from the web and general improvement of codecs you might just as well try encoding for streaming if the quality of your file initially intended for download becomes similar to the (usually appalling) quality of a film for streaming
- video is considered acceptable as long as subtitles on a 1280x1024 screen are legible and that pixels are not reminiscent of rain drops on the lens; people tend to play films at 2x size, but the same (subjective) criterion applies
- an audio bitrate of 32Kbps is hardly acceptable as music & voice get a noticeable metallic distortion, 48Kbps is still little tolerant in case of voice saturation, that's why unless you fancy remixing the whole sound track, an audio bitrate of 96Kbs seems to be a decent compromise
- reducing fps (frames per second) is a very efficient way to reduce size (I use Cinelerra's project settings to do that just before rendering the master of the film to be compressed), but depending on action in the sequence the result may be more or less fortunate - optimum settings seem to be 12 - 15 fps
alternatively, use transcode option-J fps=25:12
- I also found out (by accident) that you may reduce size by at least 15% when compressing from an already compressed film rather than the ideal quality master version; quality loss at this stage is not an issue
- compression examples & options relate to films available on the download page
Transcode preliminaries
-
to find codecs available on your OS, run:
ls /usr/lib/transcode
transcode -i unknown_film
mplayer unknown_film
Comparative chart
- when using transcode to compress films for release on the internet, consider the following - and then forget about it if you're happy with your options unless you really need to fit another film into the few xyz Mb left on your web-site
- the following chart suggests how to tweak progressively transcode encoder options
(bitrate, keyframe, crispness)
-w b,k,c
options default test1 test2 test3 test4 test5 minimum -------------------------------------------------------------------------------- encoder bitrate 1800 600 200 150 100 75 50* 50 crispness 100 100 80 50 50 20 20 20 key frame 250 200 150 80 10 8 8 6 size for 15'test 5.9M 4.1M 3.7M 4.1M
could even produce heavier output
Transcode film_jpg_quicktime4linux.mov to mpeg4 [former divx5]
- you can get a list of all options (succinctly) explained with available parameters at http://www.transcoding.org/cgi-bin/transcode?Transcode
- run various bitrate, keyframe & crispness tests
- run a 1st pass
- run the 2nd pass
transcode -y ffmpeg -F mpeg4 -w 600,120,70 -C 3 -I 5 -Q 5 -R 1 \ or transcode -y ffmpeg -F mpeg4 -w 300,100,50 -C 3 -I 5 -Q 5 -R 1 \ or transcode -y ffmpeg -F mpeg4 -w 150,70,20 -C 3 -I 5 -Q 5 -R 1 \ etc
-J unsharp,hqdn3d,smooth=0.3 --encode_fields b \ -i film.mov -o film_m4v.avi
transcode -y ffmpeg -F mpeg4 -w 300,120,80 -C 3 -I 5 -Q 5 -R 1 \ -J unsharp,hqdn3d,smooth=0.3 --encode_fields b \ -i film.mov -o film_m4v.avi
transcode -y ffmpeg -F mpeg4 -w 300,120,80 -C 3 -I 5 -Q 5 -R 2 \ -J unsharp,hqdn3d,smooth=0.3 --encode_fields b \ -i film.mov -o film_m4v.avi
Notes re. compression to mpeg4 [ffmpeg]
- most films available on this web-site (before being converted to webm for streaming) were encoded with the following settings
- the difference consists in reducing the size of the video by 2 [360x288]
- due to video players having occasionally some difficulty in recognising 16:9 letterbox format files are encoded together with their black stripes at the top and the bottom [though it is obviously a waste in terms of file weight]
transcode -y ffmpeg -F mpeg4 -w 300,120,80 -C 3 -I 3 -Q 3 -r 2 -R 1 [and then -R 2] \ -J unsharp,hqdn3d,smooth=0.3 --encode_fields b -i film_yuv_quicktime4linux_jpg_2complements.mov -o film_ffmpeg_divx5_300_120_80.avi
-r 2