7

The external hard drive on my HTPC is almost full and so I'm going to need to convert a large number of the films recorded from the television (in WTV format) into something smaller. At present, a 2 hour film is about 3-4GB.

I've tried converting the WTV file to DVR-MS (using the built in wtvconverter.exe) and then running it through handbrakecli with the following command line:

handbrakecli.exe --input "film.dvr-ms" --output "film.mp4" --encoder x264 --quality 20

In Handbrake, this would be by setting the output to MP4, the encoder to x264 and the quality to 20.

The problem is that the resulting MP4 is between 1.5 and 2GB which, whilst smaller than the original file, still seems insane for a 2 hour long SD film recorded off (a PAL) television! I would expect something like that to be 700-800MB, if not less.

Setting the quality to 19 degrades the picture to the point it's unwatchable.

Can anyone recommend settings for Handbrake (or handbrakecli) which will convert a DVR-MS file into a much smaller size?

(I'm not particularly precious about the codec or the container, but would prefer something reasonably standard to ensure it can be watched on a high number of computers and mobile devices)

UPDATE

It's probably not clear, but if you only know what the settings are to convert a file using the graphical version of Handbrake, then that is a perfectly good answer!

3 Answers 3

8

Please note: When this answer was written (July 2012), ffmpeg couldn't convert WTV files without loss of audio. However testing on ffmpeg 4.0.0 has shown that it now works fine and, as a result, there is no need to use wtvconverter.exe to pre-convert the WTV file to DVR-MS. As such:

ffmpeg -i "input.wtv" -y -filter:v yadif -vcodec libx264 -crf 23 "output.mp4"

should convert your television recording.

Original answer below

After some research it turns out that:

  1. Handbrake isn't the best tool for this, you should use ffmpeg instead.
  2. When using ffmpeg, you need to use the DVR-MS format (and not the WTV format) as the source file, otherwise you'll end up with no sound.

You need to perform a couple of steps, firstly converting from WTV to DVR-MS:

%WINDIR%\ehome\wtvconverter.exe "Recorded TV Show.wtv" "Recorded TV Show.dvr-ms"

Then converting that DVR-MS file to H.264/MPEG-4 AVC. You can change -crf 23 – higher numbers mean lower quality, sane values are from 19 to 25:

ffmpeg -i "Recorded TV Show.dvr-ms" -y -filter:v yadif -vcodec libx264 -crf 23 "Recorded TV Show.mp4"

Then deleting the temporary DVR-MS file:

del /F "Recorded TV Show.dvr-ms"

Once converted, VLC will give the following details about "Recorded TV Show.mp4":

enter image description here

The file I converted is now 530MB (down from 1.59GB) for 1 hour and 50 minutes of SD content. This means it is approximately 1/3rd of the size of the original WTV file.

3
  • Added some info on how to change the quality, if needed.
    – slhck
    Commented Jul 16, 2012 at 20:34
  • Very useful. I also found out that you shouldn't de-interlace a video (using -filter:v yadif) if it's not already interlaced otherwise the quality will get worse. There is a question here if people want to work out whether or not the recorded file needs de-interlacing.
    – Richard
    Commented Jul 16, 2012 at 20:37
  • Yup – that's how I found this post anyway :)
    – slhck
    Commented Jul 16, 2012 at 20:41
2

I was able to get ffmpeg to do the trick, but took some time to find switches that worked. Not sure these are optimum, and the conversion takes a lot longer, BUT it is clean, plays everywhere I have tried, and the audio is correct and in sync.

ffmpeg -y -threads 8 -i pbsvideofile.wtv -target pal-dvd -deinterlace -async 48000  pbsvideofile.mpg 
3
  • todayiwantedtoprogram.tumblr.com/post/15142587796 has a good description on what -target pal-dvd does. It's worth noting that it sets the video bit rate to a, rather high, 6Mbps!
    – Richard
    Commented Mar 30, 2013 at 12:44
  • This would be great if it works, because it avoids the intermediate file that is created, written to disk, and deleted.
    – Andrew Mao
    Commented Jan 7, 2014 at 19:22
  • Later versions of ffmpeg may be able to convert directly from WTV to H.264/MPEG-4 AVC, but the version I used when the question was asked resulted in no sound - hence the (slightly annoying) middle step!
    – Richard
    Commented Jan 9, 2014 at 14:00
1

Based on @suken's answer, I was able to do a batch conversion. With the version of ffmpeg I used at that time, it worked directly from .wtv to .mp4.

gci 'D:\Recorded TV\*' -include('*lola*','*buzzcocks*') | % {
    $file = $_.Name
    .\ffmpeg -i $_ -vcodec copy -acodec copy -f dvd -deinterlace -map_metadata 0 "D:\Media\TV\$file.mp4"
}

In the above:

  • 'D:\Recorded TV' is the source location
  • 'D:\Media\TV' is the destination location
  • Filtering is being done to only include shows with "lola" and "buzzcocks" in the filename (you can take this out if you want)

The command tries to transfer the metadata over (e.g. show title and description) but it didn't seem to pick up in the destination file. You could try WTV-MetaRenamer first instead.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .