VLC REC to MP4 v1.1 - Feb 08 by Snuftop - README First the warnings. The batch file "vlcrectomp4v1.1" and the recommendations below come with absolutely no guarantees. They work for the writer but may or may not work for you. The writer is a novice at batch files and transcoding, so some of what is written here is bound to be wrong. Anyone using any part of the batch file and/or following these recommendations does so at their own risk. PLEASE READ and follow carefully the rest of these instructions before attempting to use the batch file - if you don't it almost certainly won't work properly for you. WHAT DOES THE BATCH FILE DO? The VLC REC TO MP4 batch file has been written to help with using VLC to easily transcode multiple video files from Topfield .rec format to .mp4 format (in PAL). This will be most useful for people with a large .rec collection on one or more storage devices that they wish to compress for playback on a media player capable of reading .mp4 files. It works with .rec files of standard definition or high definition. The suggested settings should produce .mp4s using a single pass transcode with file sizes of around 35% to 55% of the standard definition .rec size, depending on the complexity of the video content. High definition files will be compressed to about 15-30% of their original file size. Audio quality is unchanged. Video quality, rather than video bitrate, is the user-determined constant factor, so this method is best-suited to people who just want to reduce the overall bulk of their video files while maintaining an acceptable playback quality. If you have particular target file sizes in mind for individual files or groups of files (eg to fit on removable media) this method is not recommended. HARDWARE REQUIREMENTS Topfield PVR to capture the .rec files. PC to perform the transcode with VLC. Media player to play back the .mp4 files. The suggested settings have been designed for Xbox/XBMC but they should work with any media player that can read mp4 format. SOFTWARE REQUIREMENTS Recent builds of VLC and XBMC (or other media player). The mp4s generated may not be playable if older versions are used. The batch file runs on an MSDOS command line. HOw DO I USE IT? There are several steps required to get going but most of these are 'one-offs' - when you are happy with the result of the output files, .rec to .mp4 conversion is just a drag and drop operation that can be done repeatedly with dozens of files at a time. STEP 1: OPEN VLC APPLICATION AND SET UP PREFERENCES NOTES: The following instructions are prepared on the assumption the VLC default preferences are the starting point. Only changes to the default values are specified. Some preference settings that are less likely to require changes based on individual circumstances have been set in the command line of the batch file. The preferences in the batch file will override selections made via the VLC GUI, but they can easily be edited (or deleted) from the batch file command lines if required. Step 1A. Settings-Preferences-Input/Codecs-Other Codecs-FFmpeg Tick 'Advanced Options'. Post processing quality: The VLC commentary says higher settings for this setting demand more processing power but produce better images. A 3GHz single core PC handles the maximum setting (6) with no difficulty. If you plan on playing back files on an interlaced display, tick 'interlaced encoding' and 'interlaced motion estimation'. Tick the 'Trellis quantization' box. IMPORTANT: Set 'Fixed quantizer scale' (directly under Trellis quantization tickbox) to 5. This is the setting which determines the quality vs compression trade-off. Try 5 for a sample file and if you are unhappy with the quality try lower (eg 4). Going lower than 3 may not result in much compression though. If you are satisfied with the video quality of your samples at 5 try higher until you are unhappy, then drop it back a notch. The optimal quality vs compression trade-off is a personal choice and depends on a range of factors including your display type, viewing distance, type of content etc etc. It is recommended you ensure you are comfortable with the video quality of the .mp4s you are producing BEFORE processing large batches of files. Step 1B. Settings-Preferences-Stream output-Sout stream-Transcode If your media player will play the files on a progressive scan display, tick deinterlace video and choose the ffmeg-deinterlace module. STEP 2: PREPARE YOUR .REC FILES FOR TRANSCODING The commands in this batch file for giving the output file an .mp4 extension does may not work if the file names include special symbols/characters. A symbol that produces difficulties is the apostrophe - ensure apostrophes are deleted from the .rec file names before attempting to use the batch file. If you have difficulties doing this manually there are plenty of utilities available (many are freeware) to do that task for you. STEP 3: CHECK BATCH FILE COMMAND FOR VLC LOCATION The batch file commands assume that VLC is located in the default position on your PC (c:\Program Files\VideoLAN\VLC\vlc). If you do not have VLC in that location on your PC, you will need to edit the pathway for the VLC application specified in the batch file. STEP 4: OPTIONAL - ACTIVATE AUTODELETE OPTION (USE WITH CAUTION) The batch file command includes two lines (currently dormant) that will automatically delete the original .rec file when the .mp4 has been created. Only activate this when you are confident that the .mp4 files VLC is producing are sufficient video quality for your needs and that you will not need the .rec files any more. To activate the auto-delete command, edit the batch file to delete the "rem" from the beginning of the command line that reads "rem delete %1.rec" and the following line that reads "rem echo The .REC file for...". Save the batch file with a new name (suggest 'VLC Rec to MP4 v 1.1 autodelete.bat'). WARNING: If are using the auto-delete command, never terminate the process early by closing the VLC application window, because this will terminate the transcode by VLC but the auto-deletion will still occur. If you need to terminate the procedure before it is finished, close the MSDOS command prompt window first - then close VLC. That way you can terminate the process early without losing .rec files. STEP 5: SAVE THE BATCH FILE IN THE TARGET FOLDER 'Save as' a copy of the file 'vlcrectomp4v1.1' (edited as per steps 3 and 4 above, if needed) as a batch file in the folder where the .rec files to be transcoded are located. Make sure you change the extension from .txt to .bat. STEP 6: GO! The transcoding process is CPU intensive, so unless you have a very powerful PC it is recommended that you shut down all non-essential applications/processes before you start. Drag and drop the .rec files in the folder onto the batch file. An MSDOS command line window will open telling you the status of the process and VLC should open and begin to transcode the files into .mp4 format. The process is probably working as it should if the 'needle' in the VLC application window moves very slowly from left to right. The transcoding process can be quite slow, so if you are processing multiple files try to choose a time when your PC is not being used for other things. STEP 7: TEST It is recommended that you test the playback of several short sample files on VLC and your media player BEFORE transcoding multiple files. Check the audio sync is OK and video quality is acceptable to you. STEP 8: ENJOY! Once you are happy with the results from your sample files, repeat steps 5 and 6 as often as you want to and enjoy all the disk space you will save over keeping your files in .rec format. You can drag and drop many files at once - your PC should tell you immediately if you've gone for too many for it to cope with. Good luck! Some Q&AS Q: Why does the batch file use standard MP4 format video rather than the more recent X264/H264 codec? A: The Xbox/XBMC player combination, for which these settings were primarily written, does not cope well with decoding X264 files due to hardware limitations. Q: Why isn't the audio compressed? A: The audio output is in DVD-quality format (48kHz sample rate 448kb/s bitrate AC3) which is very often overkill. However, as .rec files are often in this format when captured it speeds up the transcode time to leave it that way and there is not that much space to be gained from compressing the audio (relative to the video). It also means that on those rare occasions when the .rec files have audio tracks with 5.1 channels, the output file will have enough bandwith to cope. However, if you want to save a bit more space and compress the audio too the easiest way is just change the ab (audio bitrate) value from 448 in the relevant batch file command line to whatever lower bitrate value you choose (eg 192). You can try to change audio codecs to other formats (MP3 etc) but there are some compatability issues that you will need to navigate, so test that your chosen combination works properly before processing multiple files. Q: Why is the asf muxer used? A: In short, it works. In particular it seems to deliver good audio sync. Other combinations of codecs and muxers were not as reliable in testing. Q: Can the .mp4s be saved on a DVD for playback on a standalone DVD player rather than a media player from a network? A: Most DVD players cannot decode .mp4s. Some recently released standalone DVD players are advertised as .mp4 compatible, so it may be possible on those players. Just try it and see.