PDA

View Full Version : What's the best video format to encode into for tivo


jbernardis
10-28-2009, 10:17 AM
I have a number of video files that I've transferred to my PC from my tivo and edited out the commercials. Right now, they are all mpg files and they are quite large - a 22 minute video is 2.2GB.

I'd like to reencode these files for the following reasons:
- obviously to save space.
- I am having some difficulty with streambaby handling these files. The transcoding that streambaby does can't keep up with the video speed - the tivo keeps pausing (maybe it's not a transcoding issue - maybe it's a bandwidth issue, but I'm talking about a 100Mbit wired network here)
- finally, and I'm not sure about this one, I believe streambaby has a 1GB streaming limit. Using the above file as an example, this would limit me to about 10 minutes of video.

My first choice was to reencode as MP4(h.264/ac3) - that seems to be what everybody in this forum does. I used winff to do this - it has a mpeg4 widescreen preset. I don't recall all of the parameters, but it successfully reencoded the file and I was able to stream it. It also significantly reduced the file size. Then I noticed that it also reduced the frame size - down to 704x384 (I believe) - so I felt like I lost HD here. I noticed that the ffmpeg recipes that are part of kmttg or listed on the streambaby wiki did not change the frame size, so I removed this parameter and ran winff/ffmpeg again. Again is was successful, but this time the resultant file size was 2.18GB and there was a slight degradation in video quality. I would have accepted the video degradation if I had seen some significant space savings. When I then reduced the bit rate from 5000k to 3000K, I did see space savings, but with an unacceptable loss of quality.

So next, I looked at all of the videos I have downloaded from various internet locations. These are all AVI(xvid/mp3) files and they seem to stream quite well, so I thought I'd run the original file through ffmpeg again using the AVI preset from winff. There were no error messages, and I did achieve some space savings, but the video, when played on the PC using VLC, had no audio. I didn't even try to transfer it to the tivo or to stream it.

Now I'm not sure in which direction to turn. Part of me is resigned to just keeping these files in mpg format. As an experiment, though, I'm going to run the files through the encode step of kmttg using the ff_tivo_hd template. Hopefully I'll get some benefit from that.

orangeboy
10-28-2009, 12:00 PM
I've been playing with streaming video using VLC, and found with all things "equal", transcoding using h264/mp3 resulted in the best picture. Since it was a stream, I can't comment on how the file sizes differ. I do know it ate up a lot of processor using h264.

The following are what I passed to VLC to make my comparison between h264, MP2, MP4 and WMV:

transcode{vcodec=h264,vb=1400,scale=1,acodec=mp3,ab=96,chann els=2}
transcode{vcodec=mp2v,vb=1400,scale=1,acodec=mp3,ab=96,chann els=2}
transcode{vcodec=mp4v,vb=1400,scale=1,acodec=mp3,ab=96,chann els=2}
transcode{vcodec=WMV2,vb=1400,scale=1,acodec=mp3,ab=96,chann els=2}


It would be nice to use VC1, which I believe Netflix uses. I'm afraid I don't have the horsepower to real-time stream even if I had an encoder with that.

lew
10-28-2009, 01:12 PM
I hope I'm not "hijacking" this thread. I'm also interested in transcoding to mp4. Specifically I want to transcode to a format that pyTivo can push without having to transcode. I think OP wants to do the same thing with Streambaby.

I'm looking for the faster transfer time. I'm not looking for maximum compression (reduced quality). Hard drives are cheap, I'll go with the minimum compression. Obviously smaller file size is an advantage but that's not my primary goal.

What programs/settings work best? Looks like handbrake is popular. Videoredo is expected to add mp4 shortly. I think Nero will also work.

I searched through the pyTivo thread and there isn't a lot of current information.

reneg
10-28-2009, 01:13 PM
I think "best" is a matter of personal preference. With my four year old, single core PC, best for me right now is Xvid. Xvid streams well with Streambaby without pauses. An hour long show sans commercials fits in the 1 gigish buffer. The encoding time is about 1-1. Compressed vs original file saves me between 5-1 to 10-1 on disk space. Video quality is good, not great. Most of my content is archived TV shows. YMMV.

Listed below is the winff preset I use for pytivo/streambaby.

<?xml version="1.0"?>
<presets>
<PyTivoXvid>
<label>XviD Widescreen for PyTivo</label>
<params>-f avi -r 29.97 -vcodec libxvid -vtag XVID -s 768x432 -aspect 16:9 -maxrate 2800k -b 2500k -qmin 3 -qmax 5 -bufsize 4096 -mbd 2 -bf 2 -flags +4mv -trellis -aic -cmp 2 -subcmp 2 -g 300 -acodec ac3 -ab 192k -ar 48000 -ac 2</params>
<extension>avi</extension>
<category>PyTivo</category>
</PyTivoXvid>
</presets>

dlfl
10-28-2009, 01:27 PM
Two factors have the greatest impact on how a mp4 will look played back from your TiVo:

1. The bit rate
2. The encoding method. There are quick and dirty MPEG4 encoding methods and there is H264, which has a lot of paramters that strongly effect transcoding time and quality. Either one can do an acceptable quality but the more you compress, while trying to maintain that quality, the longer it will take to encode. This is greatly affected by your PC's throughput.

2.2 GB for 22 mins is about 13 Mbps bitrate. Typically you would try to compress the file size (i.e. bit rate rate) by a factor of 2X to 4X, with the 4X factor requiring a lot more computer effort (time) unless you are willing to compromise quality. You have to experiment with the tradeoffs using your particular computer to find your sweet spot, i.e., where the compression is worth the time it takes.

The point I'm finally getting to is that encoded dimensions are not nearly as critical to how it will look played back as the bit rate (or compression factor). For example a 1920x1080 encoding at 3 Mbps probably will not look as good as a 1280x720 encoding at 5 Mbps, and might not look as good as a 640x360encoding at 5 Mbps, assuming they are all encoded with the same H264 parameters. I've assumed 16:9 format for all cases.

I think achieving streaming speeds (i.e., encoding time equal to video length) with moderate quality H264 parameters will usually require a dual- or quad-core cpu.

lew
10-28-2009, 02:22 PM
http://code.google.com/p/streambaby/wiki/video_compatibility

may help the OP. You want to transcode to a "native tivo mode"

dlfl
10-29-2009, 09:36 AM
http://www.tivocommunity.com/tivo-vb/showthread.php?t=417335

http://www.tivocommunity.com/tivo-vb/showthread.php?t=434260

jbernardis
10-29-2009, 02:58 PM
may help the OP. You want to transcode to a "native tivo mode"

Thanks - I'm familiar with that page and have even tried the ffmpeg recipe there. Last night I also trie the kmttg ff_tivo_hd recipe, but again my 2.2 GB file only reduced to 2.18GB.

I think the lesson I got from the post above, is that reducing the frame size is not so much of an issue if I maintain a reasonable bit rate. When I change the frame size to 704x384 (or whatever it was) with a bit rate of 5000K, I got a reasonable result with significant file size savings. I was even able to stream the file - I was just under the impression that I was sacrificing the qualities of HD by having what I thought was only 384 "scan" lines.

Interestingly, the 704x384 ratio was not the exact same ratio of the original file - it was off by a few decimal places. When I changed the frame size to have the exact same ratio, I got a file that played fine on the PC, but when I streamed it to the tivo, it was messed up. At first I thought it was getting squeexed to 4x3, and it did indeed have pillars, but then I realized that the picture looked correct, but that the right hand side was being cut off by the right side pillar (the leftside was fie, so I was actually missing a significant amount of th right side). I'm not sure if that was caused by streambaby, the tivo, or my sharp TV (which has its own quirks). I went back to the original ratio, and the full-width image was restored.

So I'll use this recipe for my 16x9 video, and I have to experiment with my 4x3 video to determine what the best frame size to use there is.