When I was a kid, I often watched the animated series "Once upon a time..." (original French title: "Il était une fois...", German title: "Es war einmal..."). It tought me a great deal of history and the human body.
Fast-forward many years... Meanwhile being a father myself, I remembered these series and I bought the full DVD box set of the whole "Once upon a time..." series - a box set of 38 DVDs. Definitely not the worst thing my kids could watch on TV.
However in my household we do not have a physical DVD player anymore. Instead everything is digital, saved on a NAS and streamed through Kodi (using a Wetek Play box) on the TV. This means: I need to digitize the optical DVD discs into digital video files.
Most of the available tools and instructions are based on software for Windows. And there are lots (some even considered illegal)! But as I switched from Windows to a Linux desktop years ago, it's time to find out what tools work best on Linux.
Disclaimer: DVD Ripping/copying/digitizing can be considered illegal in certain countries. In most countries however a (digital) copy for personal use is allowed. I am in no way suggesting to do illegal copies. This article is merely a technical guide, how to digitize (personally owned) DVDs on Linux.
Handbrake is not only a software to convert videos (using different codes), it also allows to select a DVD as video source. Just click on the "Open Source" button and select the DVDVOLUME (here on Linux Mint):
Important here is that the whole VIDEO_TS folder is selected and not a single vob file inside it. Only this way Handbrake will include the full DVD content.
Handbrake then analyzes the DVD's content and lists the available media and the media's chapters in an overview:
Under the "Title" drop-down box, I expected a listing of the different episodes. But on this particular DVD, all episodes are basically one long film with a duration of 1h 44 mins. The episodes are simply "split" into several chapters.
The "Range" fields define which chapters should be ripped. This is certainly a help, however the chapters are not always equal and from this list alone, the correct episode listing cannot be seen. To make this easier (and faster) I kept the original range which includes all chapters. This will create one large video file with all the episodes (4 episodes on that particular disc).
The "Preset" selection shows a list of the most common video codecs and video sizes. The "Once upon a time..." episodes on the DVD come with a 768x576 pixel resolution and a 4:3 aspect ratio at 25 frames per second (FPS). They feature 2 audio tracks (French and English from my DVD box set). The selected preset is using Matroska/H.265 as codec, 742x572 pixel display resolution (16:15 aspect ratio) and both audio channels selected.
Once clicked on the "Start" button, it took around 2 1/2 hours until the resulting video file was created (with a 48x DVD drive and a 4 core Intel i5 CPU).
As mentioned before, the problem on these DVDs is that all four episodes are basically chapters of one big video stream. This resulted in one big video file. To separate the episodes, the video needs to be split.
At first I attempted to do this with Kdenlive, an open source video cutting tool.
Although this worked and I was able to export a cut video as a single episode, I quickly identified a problem: The multi-channel audio was gone. It turns out that Kdenlive is unable to handle video clips with multi-channel audio! A workaround would be to export both audio tracks from the video and import both of them again into Kdenlive. But that's kind of a headache to do, especially when there are easier methods around!
Instead I came across LosslessCut. The name itself is exactly what I need to achieve: Cut the big video file into multiple video files without losing quality (lossless). On my desktop I'm still running Linux Mint 18.3 which is based on Ubuntu 16.04. In that Ubuntu version the program isn't part of the official Ubuntu repositories yet, starting with Ubuntu 18.04 it can be installed using apt. But even if LosslessCut is not installable via apt on my machine, it doesn't take much more time to install it. The release file for Linux (a tar.bz2 file) already contains a pre-compiled binary, which just needs to be unpacked and executed.
ck@mintp ~/Downloads $ wget https://github.com/mifi/lossless-cut/releases/download/v3.23.8/LosslessCut-linux.tar.bz2
ck@mintp ~/Downloads $ tar -xjf LosslessCut-linux.tar.bz2
ck@mintp ~/Downloads $ cd LosslessCut-linux/
ck@mintp ~/Downloads/LosslessCut-linux $ ./losslesscut
(electron) The default value of app.allowRendererProcessReuse is deprecated, it is currently "false". It will change to be "true" in Electron 9. For more information please check https://github.com/electron/electron/issues/18397
Current version 3.23.8
Newest version 3.23.8
This opens up a GUI and the video file can be "pulled" into the GUI (from the file explorer).
The only tricky part in LosslessCut is to understand which keyboard keys to use. There are no icons, such as the typical scissor icon, to cut the video at the cursor position of the timeline. Instead the keys [i], [o] and [+] are relevant here.
Navigate with the cursor to the timeline, where an episode should start and hit the [i] key. Now search in the timeline for the end of the episode. Once you've found the frame you declared as the end of the episode, hit the [o] button. This now created a selection of the video. To add another split for another episode, hit the [+] key and continue on with the same procedure using the [i] key to define the start and the [o] key to define the end of an episode.
As you can see from the screenshot, all four episodes were selected. Each selection results into its own video file.
By clicking on "Export", LosslessCut will do the splitting in the background (using ffmpeg) and display the status in the GUI:
At the end of the export, 4 video files were created. Each file representing a single episode of that DVD:
The file name is put together using the source video (VIDEO_TS) and the input and output times of the original video.
Interestingly, the split video files all had one issue when being played with VLC: The video was shown in the middle - but as a vertical narrow band:
Definitely not something I expected! The error message in the console showed:
ckadm@mintp ~ $ VLC media player 2.2.2 Weatherwax (revision 2.2.2-0-g6259d80)
[000000000196a088] core libvlc: Running vlc with the default interface. Use 'cvlc' to use vlc without interface.
[00007fdc8c02e618] vdpau_avcodec generic error: unsupported codec 1211250229 or profile 1
Failed to open VDPAU backend libvdpau_radeonsi.so: cannot open shared object file: No such file or directory
[00007fdc8c03d688] freetype spu text error: Breaking unbreakable line
[00007fdca0c1ab68] core access error: cannot resolve services.tvrage.com port 80 : Name or service not known
[00007fdca0c1ab68] http access error: cannot connect to services.tvrage.com:80
[00007fdc8c03d688] freetype spu text error: Breaking unbreakable line
[00007fdc8c03d688] freetype spu text error: Breaking unbreakable line
[00007fdc8c03d688] freetype spu text error: Breaking unbreakable line
[00007fdc8c03d688] freetype spu text error: Breaking unbreakable line
[00007fdc8c03d688] freetype spu text error: Breaking unbreakable line
[00007fdc8c03d688] freetype spu text error: Breaking unbreakable line
[00007fdc8c03d688] freetype spu text error: Breaking unbreakable line
[00007fdca0c1ab68] core access error: cannot resolve services.tvrage.com port 80 : Name or service not known
[00007fdca0c1ab68] access_mms access error: cannot connect to services.tvrage.com:80
[00007fdca0c1c8c8] core art finder error: no suitable access module for `http://services.tvrage.com/feeds/search.php?show=Il %C3%A9tait une fois les Am%C3%A9riques %281992%29'
I'm not exactly sure what is causing this error but I suspect an outdated codec library in VLC (2.2.2). Meanwhile VLC 3.x is available which might resolve this. But as the video was played correctly with mplayer, I didn't bother.
Update: Actually the reason was that a previous VLC setting (manual video resizing and rotation) was causing this. With the default settings, the video file worked correctly in VLC.
Rule number one of troubleshooting: Rule out each program/step to find the problem. The same also applied in this case. The split video file was opened with mplayer and this time the video played just fine.
I verified that both audio tracks are still there and in general the video didn't have any weird ditches - and all looked good. Up to the final test!
Once the video files were moved to the NAS and Kodi's media library was updated, it was time to play a single episode in Kodi (18.3 Leia).
Kodi's scraper correctly identified the series and the episode numbers:
Time to see if these episodes would play correctly. And yes, they all played exactly as expected:
It works, nice!
My kids love the show, as I did when I was a kid. Some things never change I guess. And as the "Once upon a time..." series are definitely great for the development of children and their knowledge (I turned out alright!), I'm more than happy they like it. For everyone having read this article, go ahead and buy the DVD box set of "Once upon a time..." by Procidis to support their great work lasting over decades.
No comments yet.
AWS Android Ansible Apache Apple Atlassian BSD Backup Bash Bluecoat CMS Chef Cloud Coding Consul Containers CouchDB DB DNS Database Databases Docker ELK Elasticsearch Filebeat FreeBSD Galera Git GlusterFS Grafana Graphics HAProxy HTML Hacks Hardware Icinga Influx Internet Java KVM Kibana Kodi Kubernetes LVM LXC Linux Logstash Mac Macintosh Mail MariaDB Minio MongoDB Monitoring Multimedia MySQL NFS Nagios Network Nginx OSSEC OTRS Office PGSQL PHP Perl Personal PostgreSQL Postgres PowerDNS Proxmox Proxy Python Rancher Rant Redis Roundcube SSL Samba Seafile Security Shell SmartOS Solaris Surveillance Systemd TLS Tomcat Ubuntu Unix VMWare VMware Varnish Virtualization Windows Wireless Wordpress Wyse ZFS Zoneminder