# Transcoding decrypted .tivo to xvid on Linux (or Windows)?



## rlcarr (Jan 18, 2003)

I have some .mpg files I've created from downloading .tivo files to my Linux box and decrypting them.

I would like to manually (as opposed to having some server do it) transcode them to Xvid. 

I'm pretty new to the transcoding world so I would like to know what tools people recommend (I'm fine with using command-line tools if they are the best) and any pointers to specific guides/tutorials on using them to transcode to Xvid.

If it turns out there's nothing good for Linux I'm willing to use something under Windows, but I prefer Linux since my Linux box has a significantly more powerful CPU than my Windows box.

Thanks!


----------



## orangeboy (Apr 19, 2004)

ffmpeg is nice.


----------



## wmcbrine (Aug 2, 2003)

I'd suggest targetting h.264 (preferably in an MP4 container) instead of Xvid. That way, you can feed the files back to the TiVo without further reencoding in the future. I think h.264 is generally considered superior, too.


----------



## rlcarr (Jan 18, 2003)

Thanks. I've heard that (H.264 over xvid) from people elsewhere, too. Also, I've told that HandBrake is no longer Mac-only, so I'll look into that.


----------



## SDNick484 (Mar 14, 2008)

FFmpeg is excellent albeit a bit complex (it can do pretty much anything you need it to). Handbrake is also very good, and it in fact uses ffmpeg in the background.

As I've recently been transcoding some video clips, I wanted to share the command I use for going to H.264/AAC via FFmpeg:
$ ffmpeg -i input.mpg -acodec libfaac -ab 64 -vcodec libx264 -vpre slow -crf 22 -threads 0 output.mp4

The above command assumes FFmpeg was compiled with x264 and faac support, but I imagine most distros ship it this way.

Do note that this is a very CPU intensive process, and the more cores you have, the quicker it goes.


----------



## Joshua Mars (Sep 10, 2010)

wmcbrine said:


> I'd suggest targetting h.264 (preferably in an MP4 container) instead of Xvid. That way, you can feed the files back to the TiVo without further reencoding in the future. I think h.264 is generally considered superior, too.


I've converted my files to H264 and at the same time, removed the ads. How do I feed them back to TIVO?

Thanks in advance.

Josh


----------



## Alphi (Dec 11, 2004)

Joshua Mars said:


> I've converted my files to H264 and at the same time, removed the ads. How do I feed them back to TIVO?
> 
> Thanks in advance.
> 
> Josh


What you can do is either run pyTivo, Galleon, or TiVo Desktop on your computer, and that will allow you to download (not stream) nearly any video to your TiVo.

Personally, my file server at home is running Linux, with a network share dedicated to TiVo shows and stuff, and it was easy to set up pyTivo so that it would run there, allowing me to off-load stuff from my TiVo to the server (when the TiVo gets full) and transfer back just when I (or the kids) wanted to watch it.


----------



## rlcarr (Jan 18, 2003)

A few more questions...

1) With H.264 video, what audio codec(s) does the TiVo require if I want to be able to play the transcoded files on the TiVo?
2) And what container format(s) does the TiVo require?
3) Any good pointers to guides on using libx264 via ffmpeg? It appears to have eighty gazillion options...


----------



## orangeboy (Apr 19, 2004)

rlcarr said:


> A few more questions...
> 
> 1) With H.264 video, what audio codec(s) does the TiVo require if I want to be able to play the transcoded files on the TiVo?
> 2) And what container format(s) does the TiVo require?
> 3) Any good pointers to guides on using libx264 via ffmpeg? It appears to have eighty gazillion options...


For 1 & 2, this wiki should answer those questions: TiVo Video Compatibility.

For 3, I have a batch program that uses MediaInfo to gather audio and video attributes from a source file, and populates and/or adjusts some variables with what's found.

Here's a code snippet of the ffmpeg & x264 command line:

```
SET input_parm=-threads !threads! -i "!temp_path!\!file_full!"
        SET audio_parm=-acodec ac3 -ab !ab!k -ar !ar!
        SET video_parm=-vcodec libx264 -vpre veryfast -crf 20 -level 41 -r !fps!
            
        ECHO.
        ECHO ffmpeg !input_parm! !audio_parm! !video_parm! -y "!temp_path!\!file_name!.mp4"
        ECHO.
        START "ffmpeg" /BELOWNORMAL /WAIT ffmpeg.exe !input_parm! !audio_parm! !video_parm! -y "!temp_path!\!file_name!.mp4"
```
"-vpre veryfast" could have been "-fpre \some\path\to\any\profile.file", but I overlooked that option, and struggled to get the proper environment in place to use "-vpre". "-fpre" seems like it would be MUCH easier to deal with.

Through trial and error, I found that AC3 accepts specific bitrates (in k): 32, 40, 48, 56, 64, 80, 96, 112, 128, 160, 192, 224, 256, 320, 384, 448, 512, 576, and 640. I tried to pass through the original audio bitrate from the source, and ran into trouble. I ended up taking the original bitrate, and bumped it up the the next compatible level. So if the original ab was something like 76k, I bumped it up to 80k.

Hope this helps!


----------

