| What is YAMF? |
| Thursday, 07 May 2009 10:50 |
|
(click on any of the images to enlarge) YAMF stands for Yet Another Mencoder Frontend and the name alone should spell out that it is not the only one of its kind. It is a transcoder that can take an unprotected DVD, a DV input file, a transport stream or just about anything else that mencoder can read and turn it into h.264 compressed video. Here is the first issue where it distinguishes itself from other, similar tools: It only produces h.264 compressed video although it will compress AC3, AAC and MP3 audio. It also makes no attempt at creating files of special sizes that you could burn to a CD or single layer DVD. That doesn't mean you can't do it but it would be silly since the output cannot be played on a regular DVD player - so what would be the point? YAMF is written Java and all the tools it uses are available under Mac OSX, Windows and Linux so it is a true cross-platform solution. I am personally not tied to either OS so it seemed to be a good idea at the time. So the predominant idea behind YAMF is a sense of ease of usability and highest quality while achieving maximum throughput. Cranking an hour and a half of video at full HD through a software encoder is still painfully slow. YAMF can, of course, compress a DVD (legal and uncompressed that is). It does what you expect it to do, reads the title, subtitles and languages and the lets you pick and choose. You decide whether you want to transcode the audio track and it gives you a ton of options on how you want to go about it. It really doesn't differ all that much from many other tools. The output in this case is either an MP4, Matroska or AVI file. I strongly recommend the usage of Matroska due to its great flexibility but for simple titles it really doesn't matter all that much (except for the fact that neither MP4 nor AVI maintain chapter information). This is not a YAMF drawback - it is simply that nobody thought of it when developing these containers. There are some proprietary extensions that attempt to work around these issues (Nero, etc.) but the bottom line is that only Matroska offers a clean chaptering interface (of the three mentioned). When you compare YAMF with Handbrake or MeGUI you may think there isn't all that much difference but upon closer examination - there is. I abandoned Handbrake when I realized that it kept dying on me, constantly, when using anything but the most trivial HD material in TS or m2ts format. MeGUI is built on top of the flawed Avisynth methodology which has a horrible habit of running A/V out of sync (besides not being available under Linux/Mac at all). I am not going to delve into the specifics on why this is so but while MeGUI is a terrific tool its dependence upon Avisynth voids most of its advantages. In addition I was seriously more interested in compressing HD material. If you have an unencrypted BluRay disc you may have used Clown BD before. It's a great tool that makes it extremely simple to combine all these various streams into a single transport stream (TS) which you could play - but darn, those things are pretty big. This is where YAMF comes in: It knows how to read TS files and it does a pretty good job at crunching them down to about 1/5th the size without noticeable loss in quality. While I will get to this in more detail in a moment I should mention a few other noteable features: Once you have begun working with a gazillion x264 parameters and audio encoding and filers and what-not, it can get pretty frustrating to remember all of them. This is where YAMF's presets come in. You can create any combination of audio and video compression and filtering a remember them in a 'Preset'. Yes, MeGUI has a gazillion presets and if you feel like it - you can reproduce them all. However, YAMF has a few nifty encoding parameters which make it particularly suitable for portable devices, something many other freeware encoders cannot do. Finally, YAMF also has the concept of 'Jobs'. A 'job' is an encoding process that you can either execute in sequence or 'queue up'. So why would you want to execute more than one in parallel? The reason is really that not everything in mencoder is multithreaded. There are many filters and audio-compression code which make use of a single CPU. If you happen to run a quad core you will find that that you just can't squeeze that 100% CPU out of it - that is until you run more than one encode in parallel. You shouldn't go crazy here - two or a maximum of three are plenty but if does help to improve the throughput. How to get startedThe first thin you need is to obtain a copy of mencoder/mplayer, tsmuxer and mp4box (the latter only if you are interested in creating files in the MP4 container format). If you are running Linux chances are that your distro already provides an mencoder build. Otherwise, under Windows you can download one from Sourceforge or from my web site, http://www.24hourloop.com. For Mac OSX you will have to find a port. You can find a copy of tsmuxer at http://www.smlabs.net/tsmuxer_en.html. You will also in all likelihood the Matroska multiplexer (mkvtoolnix). Moritz Bunkus puts out regular new releases for all sorts of Linux distros and Windows and what-not at http://www.bunkus.org/videotools/mkvtoolnix/. You will find that these are not particularly esoteric tools or hard to find. All of them are free which means they come under some sort of open-source license. Install them as directed - it differs on the tool how this exactly happens. Then start YAMF and go to 'Tools-Profile' and you should see something like this:
Crop frames are the number of frames that YAMF will examine in order to determine whether part of the movie can be cropped, i.e. is somehow letterboxed. This wills ave a bit of space and increase the encoding process. It really does not relate to how many pixels you want to squeeze you want it to create in either dimension. For example, you can easily create a file with an aspect ratio of 2:35 to 1 with 720x480 pixels natively. Don't worry, YAMF tracks the actual representation of the movie and hopefully you picture will never be squeezed or stretched. The more frames you specify here the better the guess YAMF can make but if it happens to pick a part of the movie which is extremely dark you might wind up doing the cropping manually. However, this should be very rare. The number of concurrent encodes relates to the number of instances of mencoder that YAMF will run in parallel - that is if you have more than one queued up. If a language of an audio or video track is hard to guess or somehow defaulted to, the language you specify here will be picked as default. Also, if you encode a piece of video that has no chapter information, YAMF will insert chapters every x minutes and you can specify this number here. The only reason it does so is to make navigation a little bit simpler. Once you have specified your tools in the profile you are essentially ready to go. How to encode a DVDTo preface everything: YAMF makes no attempt at decrypting any material. For one it is illegal where I live, secondly you might want to consider paying the studios and thirdly there are plenty of tools that can do this for you if it is appropriate for the country of your residence. Many countries allow to make a backup copy of the material you own. YAMF's main window is made up of a number of tabs and the first tab on the left allows you to switch betwwen DVD and file mode:
As soon as you select the Video_TS folder YAMF will begin analyzing the DVD structure, a process that can take up to a minute. Once it has completed this it will show you the individual titles it has found:
You will see something along these lines: Note that the video and audio information is as accurate as mencoder would show it to you which means that in most instances you will see a frame rate of 29.97 seconds even if you are inspecting a regular DVD (which in most cases has a frame rate of 23.976). However, this is easily changed as you will see in a second. You can now switch to the audio tab and choose the encoding for the audio track: Note how the lower bottom of the application always shows the resulting command line. Once you have everything set up nicely the way you intend it to be you can always simply copy and paste it from there - if you have some reason to do so. Switching to the x264 tab you can now pick a great deal of h.264 encoding options. If you set a specific bitrate here I would suggest doing multipass-encoding, i.e. setting the passes value to something more than one. If you don't really care all that much about the bitrate and simply want a specific quality - move the quality slider around a bit. How exactly this application looks depends quite a bit on the underlying OS (Linux will show you an actual quality number whereas Vista Win7 does not) but you can always have a look at the resulting common at the bottom. The quality slider relates directly to the crf value that will be shown when you do not go after a specific bitrate. Something between 21 and 25 is probably a good value. In this case increasing values for reference frames, B-Frames, turning on Mixed References, weighted B-Frames etc. will reduce the overall file size while maintaining quality. Please find a better piece of literature on the exact meaning of these values. People have written volumes on them. The final piece of information YAMF needs is filtering information which you can pull up by selecting the 'Filters' tab (let's leave the streams aside for now): Also note that YAMF does not necessary assume square pixels and cropping will not lose any native resolution. The actual native resolution of the output material is determined by the height and width shown. If 'Lock output' is ticked those two values cannot be accidentally changed. When you untick this checkmark you can set the output resolution to whatever you like. If you check 'Lock ratio' while doing so a change in the Height will be reflected in the widtha nd vice versa. However, the whole thing will not take effect unless you also tick 'Scale'. This comes in handy when you store these profiles and apply them later on. The rest of the filters are a bit trickier and you might want to delve into the mencoder documentation if you are really interested or just try them out and use the preview function to see what happens. In order to do so flip back to the main tab and click the preview button. YAMF's main window will disappear and show you the mplayer window where you can observe the results of most of your settings. There is also a slider that allows you to scrub around the timeline and the window accepts the usual mplayer keyboard shortcuts. Once you are happy with your settings I would suggest you save them before poceeding. For this you use the 'Preset window'. You bring it up under 'File->Presets' and it looks like this: To save your current settings click on the Add button and a new line will appear in the table. When you click in the leftmost column you can give it any meaningful name you like, The three checkmarks on the right pertain to what it is that you want to store. Maybe you only want to remember the video encoding settings and reapply them later on. Or you want to save all the settings you have chosen. Tick the checkmark corresponding to the settings you want to save. You can also import settings that someone else (or I) have cobbled together for you. In this case your settings will be merged with the new settings. So how do you apply presets? Simple. Just right-click on the line you want to apply to the current file or DVD and select 'Apply'. All setting for which the preset was saved (video/audio/filters) will be applied immediately. Saving an encodeYou do not have to immediately begin encoding your DVD or file. There are essentially two ways to save your settings:
So how does the job list work and what does it contain? Essentially it contains specifications of all encodes that you have set up to the last details. This becomes especially interesting once you start working with Transport Streams as input as the amount of information per encode can be considerable. The easiest way to add something to the job list is to select 'File->Add to job list' (or even better just to press Ctrl-A). So how do you see what is in the job list? Simply select 'Tools-Job List' (or Ctrl-F). A window will pop up that looks something like this:
We can do a whole lot to the jobs in the job list when you right click into it: So why does the job list not show any stream information for Transport Streams? The processing of transport streams (BluRay) is much more sophisticated and YAMF possibly demuxes and converts a slew of audio and video streams in a variety of languages so that the display here would not be all that meaningful. If you ever want to know the details of a transport stream encode, simply pick the edit option and you will see all the wonderful things it will do. The Clean up button allows you to quickly remove all titles that have been processed from the list so you don't have to do it individually. Clicking Start will begin the encoding process. Depending upon how many parallel encodes you defined in your profile you will see that many profile windows pop up that will show you basic information about the compression progress, If you need to you can cancel an individual compression (in which case the next one off the queue will start) or you can cancel the whole encoding process. Once an encode has been interrupted you will need to 'Ready' it again using the pop-up menu above. This about should cover the basics of DVD encoding. Encoding straight video filesThis is as simple as changing the the button on the main tab from Video_TS folder to file. The file selection dialog that is shown when you click on the button to the right of the input file field will now allow you to select any video file mencoder can understand which generally includes Avisynth based pseudo file streams under Windows. Now, however, no title selection dialog will appear (obviously because no such information is contained in the input file) (An exception are Transport Streams which you can read up on further down. From that point on there are really no differences top the DVD encoding steps. Adding chapters to a DVD or video fileBy default YAMF will automatically extract chapter information from a DVD and multiplex it into a Matroska output file. When you are working with arbitrary video files this may not be possible. In this case you may use the 'Chapter file' text input box (activated via the button to the right) to select a chapter file that the Matroska multiplexer can understand (i.e. either the basic two line format per chapter or an XML chapter file). Make sure the file stays around until YAMF is done processing as the multiplex step occurs towards the end, possibly hours after the encode has started. Adding additional output streamsThis requires a Matroska container as output format due to the limitations of the design of the AVI and MP4 container. To add an audio or subtitle stream switch to the stream tab.
The stream will be multiplexed as is: Subtitle streams will also be straight multiplexed with the exception of the SUP format (the extension is required). SUP style subtitles will automatically be converted to Vobsub (idx/sub) subtitles which makes the whole process of conversion into the Matroska container easier. The conversion happens on the fly and you will never see the actual sub/idx file. Most open source programs know how to read these subtitles whereas many do not read SUP subtitles. What can go wrong here: Bear in mind that YAMF allows you to convert the size of the movie. Assume you start out at full HD resolution and transcode down to SD. SUP subtitles are bitmaps and now much too large. YAMF makes a best effort attempt to re-size the subtitles into the proper format which will work just fine as long as you stay somewhat in the boundaries of standard resolutions. Once you begin to re-size to 480x480 or some other obscure format that will not work that well anymore. In that case perform proper format conversion with some other tool and specify the resulting output stream instead. YAMF uses the fine bdsup2sup library and if it properly re-sizes the subtitles - so will YAMF. If it cannot - you must take manual steps. Encoding transport streams
Transport streams can originate from a variety of sources such as HD PVRs, BluRay (using BD-Clown), manually multiplexed using tsmuxer or other places. The interesting part about them that they, unlike a regular MP4 or AVI file can contain a variety of different information. In that respect the TS format is somewhat similar to Matroska. While DVDs can also contain streams such as chapter information and multiple audio and video streams they are generally limited to an MPEG-2 encoding format and a relatively low resolution (such as NTSC 720x480 or PAL 720x576). Also, the format is much less convenient to handle, being limited by both ISO format file sizes or the maximum size of every individual component of 1GB each. YAMF has some special support for transport streams but its real strength only comes into play when you use the Matroska output format as this format can support more than a stream and has a convenient means of multiplexing them. While everything still applies that you have read about regular video files, YAMF will also automatically detect the types of streams contained in a transport stream container. It will transcode the main audio and video and automatically add the rest to the 'Streams' tab. This looks something like this: If you decide you do not want to include a stream in the resulting output file, simply right-click on it and select 'Delete'. The default is to include all streams so make sure to check the Streams tab before starting the encode. When you add this encode to the job list all the information is saved (as is when you manually save an encode). Those are the basics. Happy transcoding and let me know how it goes! |
