Transcoding

Digital recordings and converting between them.

April 23, 2020 — October 5, 2022

compsci
computers are awful
information
making things
metrics
music
photon choreography
standards
Figure 1

Technical details of converting audiovisual formats from whatever I have, to whatever I need because everything disagrees about how to transmit these things.

Check with your local jurisdiction’s intellectual property laws before doing any of these. I honestly have no idea any more what is legal and what is not, and am not qualifed to advise on the legality of anything here, in any jurisdiction.

Figure 2

1 Streaming

Ant provides open-source WebRTC streaming.

2 Misc downloaders

  • FlexGet

    FlexGet is a multipurpose automation tool for all of your media

    Support for torrents, nzbs, podcasts, comics, TV, movies, RSS, HTML, CSV, and more.

3 Creating MP3

Use lame. My default fairly hi-fi mode is

lame --preset fast extreme

4 FFMPEG

The ubiquitous multitool of audio/video decoding. Essential. See FFMPEG.

5 Handbrake

Handbrake is a GUI for movie conversion. It also has a useful Comamnd line, installed separately.

6 fre:ac

A transcoder for audio which works many useful places including Windows. The UI is functional if confusing.

7 XLD

XLD, X Lossless Decoder, is an excellent free app for transcoding arbitrary audio between formats. It is open source and has a great UI but only runs on MacOS.

8 Vapoursynth

High effort, high-fidelity scripted transcoding.

9 Video players

See playing video

10 Editing video

See video editors.

11 Searching/indexing/analysing music

I made a new notebook for that.

12 PDFs

See PDFs.

13 Photos

See photos.

13.1 Images

See image editing.

14 Learning codecs

Can I train a neural network to learn a low-bitrate encoding scheme for data? maybe.

15 Rip web videos

This was essential when I was teaching in Indonesia and the bandwidth in the classroom was too low to allow us to stream the video. AFAICT it is legal in Indonesia as long as you don’t show penises in said video, but I am no lawyer, so do not take this as legal advice. I suspect it is illegal in DMCA jurisdictions, in which case, don’t do it there.

youtube-dl (source) is a script that (despite the name) downloads not just youtube videos but whole playlists of videos from many websites, setting up transcoding etc for offline use.

$ brew install youtube-dl
$ youtube-dl 'https://www.youtube.com/watch?v=esV6ypDDoVA'
[youtube] esV6ypDDoVA: Downloading webpage
[youtube] esV6ypDDoVA: Downloading video info webpage
WARNING: Requested formats are incompatible for merge and will be merged into mkv.
[download] Destination: BIGGEST WAVES EVER SURFED IN HISTORY …-esV6ypDDoVA.f136.mp4
[download]  53.3% of 56.97MiB at 1.61MiB/s ETA 00:16

youtube-dl was taken down by the RIAA. And then not. Lesson: If apps like these are important to your activities (and naturally, if the activities they enable are legal in your jurisdiction) then you would be wise to keep your own copy rather than relying on it remaining online. The potential use in infringing American and German law seem to mean that access to them is tenuous for the rest of the world.

yt-dlp/yt-dlp: A youtube-dl fork with additional features and fixes is a hipster alternative.

brew install yt-dlp

You-Get seems approximately equivalent. The website is better. when downloading a looping video off youtube I noticed that it downloads an infinitely long video.

Jwz’s minimalist youtubedown is a script that seems optimised for a no-fuss server-side download bookmarklet:

Given a YouTube, Vimeo, Tumblr, Vine or Instagram video URL, downloads the underlying video file, with a sensible file name. It downloads the highest resolution version of the video available: first it tries HD MP4, then regular MP4, then WebM, and finally FLV. It also works on playlists, and works as a bookmarklet to download the video you’re watching.

Need offline versions of youtube videos or youtube video soundtracks? Firefox extension Media extractor gets these.

16 Ripping DVDs

xenomachina/dvdrip is a useful script to bulk convert DVDs using handbrake CLI that works around some weird misfeatures of Handbrake. It has a glitch with recent handbrake.

17 Ripping VCDS

Rip physical VCDs because copying the file on the apparent filesystem is not sufficient. (See also “ripping VCD to various formats”.) Two alternatives.

Firstly, there is a dirty option using Mencoder which is ubiquitous but ugly.

$ mplayer vcd://  # tells you how many tracks. rip desired ones:
$ for i in 2 3 4 5 6; do
>   mencoder vcd://$i -oac lavc -ovc lavc -o track_$i.avi ;
> done

Depending on where you want to play it, the following non-re-encoding step might be more hi-fi:

mplayer vcd://2 -dumpstream -dumpfile filename.mpg  # No re-encoding

On the other hand, you might want to play this on a mac, which does not natively support these formats; so you’ll need to re-encode. See FFMPEG for that, since I couldn’t make it work with Mencoder.

Second alternative: use a specialist VCD ripper, such as vxdxrip in the vcdimager system.