Monday, October 29, 2018

[solved] (sort of) webm format on older hardware

Laptops and desktops from 2007 or 8 seem too slow to view WEBM files -- their hardware is probably insufficient to decode WEBM on the fly. This manifests when using VLC: I get significant tearing and block pixillation. I've tweaked acceleration and RAM arrangements, but have never found a solution for these distortions when watching WEBM on old hardware.

Eventually, it came down (sadly) to converting WEBM to MP4 or AVI. Since MP4 is a long established container, it plays on nearly anything, if the bitrate isn't too high. A simple CLI solution always seems efficient for this kind of a conversion. After Googling, I came across this page which advised the following:
$ ffmpeg -i input.webm -c:v libx264 -crf 20 -c:a aac -strict experimental out.mp4
This works all right.

round 2

If time permits, or if the bitrate has to be brought down (4700K fine for sports, 1100K fine for teaching), I like the approach of breaking out the video and the sound and recombining. Let's say I want a teaching vid, shot at some ridiculously high 14000K bit rate, to play well on an old laptop or look good on a 55" screen...
$ ffmpeg -i original.webm -vn -ar 44100 -ac 2 sound.wav
$ ffmpeg -i original.webm -vcodec libx264 -b:v 1000k -s wxga -an video.avi
$ ffmpeg -i video.avi -i sound.wav -acodec libmp3lame
-ar 44100 -ab 192k -ac 2 -vol 330 -vcodec copy -b:v 1000k output.mp4
... taking the volume up just a hair to overcome any transcoding loss.

rotation

A lot of times for cell phone vids, the video is rotated 90° one direction or the other. To straighten, add the '-vf transpose' option. 1 rotates +90, 2 rotates -90, and 0 and 3 do something that also includes flips...
$ ffmpeg -i original.webm -vn -ar 44100 -ac 2 sound.wav
$ ffmpeg -i original.webm -vcodec libx264 -b:v 1000k -vf "transpose=2" -s wxga -an video.avi
$ ffmpeg -i video.avi -i sound.wav -acodec libmp3lame -ar 44100 -ab 192k -ac 2 -vol 330 -vcodec copy -b:v 1000k output.mp4

resolutions

Here's a resolution page that might come in handy. 5:3 resolution is just a hair away from the Golden Ratio, and I like it. The most common of these is 1280x768 or WXGA. A standard GoPro does a 1280x720 (HD 720), which is closer to the old 4:3 ratios of VGA, SVGA and so forth. But since I like 5:3, I try WXGA -- if it looks stretched, then I drop to XGA (1024x768). Incidentally, there are still perfectly usable old handheld media players around that do 4:3 320x240 (QVGA). These are maybe $5 in a bargain bin at Fry's or whatever. Naxa made one of these rechargables with 4G memory.

No comments: