Showing posts with label flac. Show all posts
Showing posts with label flac. Show all posts

Thursday, 7 August 2014

Ripping DVD with FFMPEG

This more a post to myself than to others, but even so, others might find it useful as well. Because sometimes having a DVD is inconvenient compared to your usual Matroska file saved on a HDD, I was looking for a simple way to encode the DVD. I have it decrypted and copied in a folder, but there are a bunch of 1 GiB VOB files, which is a) big, b) inconvenient. So the idea is, join the VOBs and transcode it into h264 (substitute theora, vp8 or dirac if you are more radical FLOSS supporter than me) and FLAC for audio. Actually simple search on the net presented me with an easy solution using FFMPEG (I kinda had problems with using the GUI ripping software), but it took some more research (reading the ffmpeg man pages) to find out how to rip more than one audio stream into the final file (I used a JAP/ENG DVD about Aikido).

So, without further ado, here's the command:

ffmpeg -i concat:VTS_01_1.VOB\|VTS_01_2.VOB\|VTS_01_3.VOB -map 0:v -map 0:a -c:v libx264 -crf 18 -vf yadif -c:a flac aikido.mkv

And some info:

  • The ffmpeg command is in ffmpeg package, from rpmfusion free. It's not in Fedora proper because of patent issues, I believe.
  • -i concat:VTS_01_1.VOB\|VTS_01_2.VOB\|VTS_01_3.VOB marks that input file is a direct join of the three VOB files listed, the backslash is to escape the "|" so that it's seen by ffmpeg instead of bash.
  • -map 0:v tells that ALL video streams are to be copied/transcoded.
  • -map 0:a tells that ALL audio streams are to be copied/transcoded.
  • -c:v libx264 tells that for video streams we'll use libx264 codec (i. e. we'll transcode to h264).
  • -crf 18 tells that we want to use Constant Rate Factor, value 18 (which might be a bit of overkill, but I don't want to sacrifice quality for space and I don't have the time tune it).
  • -vf yadif use YADIF deinterlacing, because I don't wanna keep interlacing in the video – I'll be playing it on a computer, after all.
  • -c:a flac tells we'll be using FLAC for audio streams. It's free and lossless. Again, it might be overkill, but I like to keep the original sound without using nonfree codec like AAC or AC3.

When I originally omitted the -map parameters, only single video and single audio stream were transcoded, so it's necessary if you want to transcode more audio streams or different stream than the first one.

Sunday, 7 September 2008

Making High Quality Screencasts

Ok, I think I have finally figured a good way how to make high quality screencasts. So I'll write here about it here, both so that I have a place to look to when I forgot and for my readers ;-)

Needed Software (Package Names)


gtk-recordmydesktop
oggvideotools
mkvtoolnix-gui
subtitleeditor (or any other subtitle editor)

All the software is available in Fedora.

Recording the screencast



First, it's good to prepare what you are going to show so that you can record the screencast in one go. When you have decided what are you gonna show and how, open Applications -> Sound & Video -> gtk-recordMyDesktop. In the opened window you see a preview of your desktop in which you can select the area of the desktop you are going to record. If you are going to record just one application it might be useful to let it select the are for you by selecting a window you are going to record.

Set Video Quality to 100 (you want to record the screencast in highest possible quality, don't you) and if you don't want to record sound (which I do not) uncheck the check box to the left of Sound Quality. By clicking Save As you can select which the filename (and directory) to which the screencast will be saved.

Now, when you set everything, hide the window either by clicking ctrl+H or right-clicking on "record" icon in your notify are and selecting hide. Then you can start recording by left-clicking the record icon in your notify are. The icon will change to "stop". When recording, when you right-click on it the recording will pause (and the icon will change to "pause"), when you right-click on it once more it will resume. When you'll left-click on it the recording will stop and encoding (unless you encode on the fly, which can be set in settings) will start.

Once the encoding is finished you can close the gtk-recordMyDesktop and extract usefull data from it (since the .ogv file generated by it contains some skeleton track it renders it almost impossible to work with). We'll do that using oggSplit. Just open terminal, navigate to the directory you have the .ogv file in and run oggSplit <filename>.ogv. It will extract the video (and audio) track(s) into usable files. The file with video track will be named theora_*.ogg. Rename it to your liking.

Creating Subtitle Commentary



Now it's time to create subtitle commentary. You can do it with your favourite subtitle editor, the one I chose is subtitleeditor. I'll not delve into how can you create subtitles because it's pretty straightforward. Just bear in mind that you need the subtitles kept on the screen long enough so that the readers will be able to read them and they should better explain what is happening in the screencast.

Creating the subtitle commentary is good practice mostly because:

  • Deaf people can read it

  • It's easier to translate than spoken word

  • Text does not have "strange whatever accent"



Combining Things Together



Now the most important thing is to put things together in one file. Open Applications -> Sound & Video -> mkvmerge GUI. You'll probably need only the Input tabs but if you are creating some more sophisticated/long screencast the other tabs might come handy too. First add all source files (the ogg file with video, the file(s) with subtitle(s), file with audio, ...) - just click on Add and add anything you want.

In General Track Options you can set for each track various settings. For audio and subtitle tracks it is good practice to select a language it is in. It is also not a bad idea to add Track name to each track.

Finaly set output filename (ending with .mkv) and hit Start muxing and you are done.

Adding Translation



The very same way you put the things together in the previous step, you can also add other tracks to already finished Matroska file. But, in case you'd like to add new subtitle translation you'll probably need one of the subtitle file in the screencast first so that you won't have to do it all from the start.

First open Applications -> Sound & Video -> mkvinfo. In it open the screencast Matroska file you'd like to translate and look for tracks. If the Matroska file has subtitle track, then sooner or later you'll find a track which will have Track type: subtitles at ... See whats Track number of that track. Suppose it's 2. Now open terminal and run mkvextract tracks <filename>.mkv 2:<subtitle-filename>. It might look like this:

$ mkvextract tracks echo-add-new-icon.mkv 2:echo-add-new-icon.ass
Extracting track 2 with the CodecID 'S_TEXT/ASS' to the file 'echo-add-new-icon.ass'. Container format: SSA/ASS text subtitles
progress: 100%


Now translate the subtitles using your favourite subtitle editor save them into some file and add it to the original screencast using mkvmerge GUI tool.

Some Screencasts Created This Way



Originally I researched how to do high quality screencasts because I needed to create screencasts accompanying various Echo tutorials.

Here are some:
echo-set-up.mkv
echo-update.mkv
echo-add-new-icon.mkv

Links


recordMyDesktop Homepage
oggvideotools Homepage
mkvtoolnix Homepage
Matroska Homepage
Theora Homepage
New high-quality totaly open (as in freedom) video compression format Dirac and its Schrodinger implementation (available in Fedora repositories)
Wikipedia article about Matroska container, OGG container, Theora video, Free Lossless Audio Codec (FLAC), Vorbis audio, Dirac/Schrodinger video.