Travel

All Free Stuff – A Bit About Video Conversion

This Sony A6000 is quite a nice little camera: New Camera, New Challenges. I am SO still learning all about it, what it can do and what some of the stuff means.
Like, interlaced versus progressive. My camera shoots in 50i (24M and 17M – not sure what that’s about), and in 50p (28M), 25p (24M) and 25p (17M). I’ve learned that the best thing to do if you’re shooting mainstream YouTube-able stuff, you want to shoot in progressive. Interlaced is for burning to DVD or BlueRay.
However, I didn’t realise this until after we got back from NZ, so I have all this interlaced video I have to convert to progressive. Here’s where ffmpeg comes in handy.

I may be leaving a few folk here with this flight into philosophy on software and freedom and all that, but anyway, it’s a major focus to me: freedom in computing, and so all of this is happening in Linux Mint (Rosa), and the video-processing is largely done at the command-line. There are those who feel that not having a GUI (graphical user interface) is too backwards and old-school and neck-beard-ish for them, but it’s actually easier than it sounds. No, you do not have to type a long, arcane command into the command-line window every time. You might the first time, but then, if you’re doing the same thing over and over – like what I’m doing – de-interlacing and stabilising video – you can just up-arrow to a previous instance of the command, change a few things, and run it again (hit enter).

So, here’s what I’m doing to de-interlace and stabilise video recorded on my Sony A6000. First of all, the format is MTS: I want mov files. And I want them in progressive format. So the command is:

ffmpeg -i 00017.MTS -c:v libx264 -preset veryslow -crf 16 -vf yadif -strict -2 a017di.mov

Looks a mouthful, don’t it? Here’s what I understand about it: ffmpeg is the program name, so you sort-of need to tell bash this is what I want to run. bash is “Bourne Again Shell”, which is the command-line program-executing thing. A wee aside: it’s so cool, bash is, that Microsoft just included it in Windows 10 for the developers! So, yeah, it’s pretty powerful stuff.
Okay, back to ffmpeg.
For some of these commands, by-the-way, just reading the documentation can leave you more befuddled than before. Google is your friend, here… found some very helpful hints on this site about transcoding video for quality.
The -i stands for ‘input’. Then, you enter the name of the file being worked on, which is 00017.MTS. This name has to be entered exactly the way it is listed in your file folder. If you left off a ‘0’ or typed MTS: ‘mts’ (lower-case), Linux and bash would spit the dummy. Very important to be precise.
The next bit refers to the preferred codec (libx264), which is – incidentally – the most common and versatile video codec out there. We want to do the conversion from interlaced to progressive with as little loss as possible so I’m going to let it run very slowly. -crf stands for “Constant Rate Factor’, which “preserves an overall level of quality throughout the file by adjusting each frame’s bitrate based on the given quality level”. With ‘0’, you get a HUGE file, but no loss in quality (and it’ll take forever). With ’51’ you get rubbish quality / high rate of compression.
‘yadif’ is the plugin that does the interlaced/progressive conversion, and the ‘-strict -2’ bit is to ensure the audio is faithfully copied as well.

I went ahead and copied the audio, but it was recorded using the camera’s inbuilt microphone, which is pretty ordinary. I do have a Zoom H1N, but didn’t bring it on this trip. Need to get in the habit of using it for audio.

Okay, so that’s conversion. This is getting really long, so I’ll talk about video stabilisation in the next post.