Issues using ffmpeg to transcode videos for tivo

Discussion in 'TiVo Home Media Features & TiVoToGo' started by jbernardis, Jun 26, 2011.

  1. jbernardis

    jbernardis Active Member

    1,077
    0
    Oct 21, 2003
    Princeton NJ
    What is the proper way to transcode videos that have a non-square PAR so that they display properly on the tivo?

    I have some old movies that are filmed in a 2.35:1 aspect ratio, but the DVD they are on was originally created for a 4:3
    display. I'd like to transcode them so that they are properly formatted to play on my widescreen TV through my HD tivo without
    having to use zoom. They should be letter-boxed - I'm aware of that - but they should fill the screen from left edge to right edge.

    Here is what I've done so far: The DVD aspect aspect ratio is 720/480. Since 720 represents the full width of the movie
    I divided this by 2.35 to get the height of the movie between the letterbox border - this came out to 306 meaning the top and bottom
    letterbox borders total 174. Since half of this is 87, I chose 88 to keep it a multiple of 4. I used ffmpeg to crop to 720x306, and then to scale
    to 1280x544 (the same 2.35:1 ratio) and then pad out to 1280x720. Here are my ffmpeg parameters to do this:

    -vf "crop=720:306:0:88, scale=1280:544, pad=1280:720:0:88"

    I verified the results with mediainfo. However I saw there that even though the dimensions were 1280x720, it showed the DAR
    of 1.58. (1280:720 * 8:9 = 1.58:1) When I tried to play this on the tivo, indeed I got sidebars on the screen - this is not at all what I wanted.

    I tried setting the aspect parameter to 16:9, but this resulted in a final DAR of 2.2:1 (I can't figure this one out) and the video was
    over-wide and squished top to bottom.

    Once I discovered that the PAR of the original file was 8:9, I did some math resulting in a changed scaling factor - instead of 1280x720, I changed
    the target dimension to 1440x720 which when multiplied by the PAR of 8:9 results in a DAR on 16:9. Voila - mediainfo showed the desired results - however
    the tivo still had side bars.

    I don't know what to do next. Is there someway to transcode so that the resulting pixels are square?
     
  2. ThAbtO

    ThAbtO TiVoholic by the bay TCF Club

    11,691
    922
    Apr 6, 2000
    SF Bay Area
    Try VideoReDo and under options when you save the video to set for 16:9

    I did it with some video that originally was 16:9 but the DVD recorder is 4:3 so it got squished, ripped the DVD, then through VideoReDo, it un-squished the video.
     
  3. jbernardis

    jbernardis Active Member

    1,077
    0
    Oct 21, 2003
    Princeton NJ
    Unfortunately that didn't help. I still get either a 1.58 DAR or a 2.2:1 DAR.

    I did a lot of thinking about this between laying awake, showering, and driving into work. I think I made a mistake in my math, but I can't try it out until this evening.

    I think my mistake was dividing the 2.35:1 Film DAR into the 720 to get the film height. The problem is that the DAR is not the same as the SAR, and I divided a DAR ratio into an SAR dimension. I need to first convert the DAR ratio into SAR terms by dividing by the PAR. If I divide DAR 2.35:1 by PAR 8:9, I get SAR 2.64375:1. If I divide THAT into the 720, I get a film SAR height of 272, not 306 as I had previously. This results in cropping parameters of "crop=720:272:0:104".

    So now I have a 720:272 SAR image with non square pixels. Now I want to scale it up to 1280 width. However, 1280 is a DAR dimension - I first need to convert it to SAR by dividing by 0.88888 (the PAR) to get 1440. To scale to this width and maintain the aspect ratio, I need to scale to "scale=1440:544".

    and then finally pad the 544 up to the 720 height by adding (720-544)/2 = 88 lines. "pad=1440:720:0:88:black".

    I'll try this tonight to see what happens.
     
  4. jcthorne

    jcthorne Well-Known Member

    3,116
    196
    Jan 28, 2002
    Houston
    I'll be pretty surprised if this works on a TivoHD. For 720p video, the series 3 units need the video to be 1280x720 EXACTLY with square pixels. IE non-anamorphic. Its a bug in the series 3 decoder.

    I know how to do this in meGUI but not the command line for ffmpeg as I run into it when I convert PAL DVDs that are widescreen to mp4.

    For meGUI, I edit the avsynth script to resize 1280,544 then addboarders 0,88,0,88. This results in a 1280 x 720 frame with the 2:35 video in it with square pixels.
     
  5. ThAbtO

    ThAbtO TiVoholic by the bay TCF Club

    11,691
    922
    Apr 6, 2000
    SF Bay Area

    Uh what? Now I got confused trying to make sense out of that.
     
  6. jbernardis

    jbernardis Active Member

    1,077
    0
    Oct 21, 2003
    Princeton NJ
    jcthorne was right. Although the video played just fine, it still had sidebars, and the aspect ratio seemed a bit off.

    I guess I'm resigned to the fact that, for these old DVDs at least - letterbox in a 4:3 frame - that I should keep them in their native 720x480 frame size an just use the "aspect" button to zoom in on them It's what I had to do when watching the physical DVD, so nothing different there.

    One question though. The DVD I was playing with had a frame rate of 23.9+ fps. Is this OK with the tivo, or should I encode to 29.97? I believe I've also seen DVDs at 59+ fps. Are these tivo-compatible or should I transcode them?


    Thanks
     
  7. jcthorne

    jcthorne Well-Known Member

    3,116
    196
    Jan 28, 2002
    Houston
    If you encode them to 1280x720 and 23.976 fps, a TivoHD will play them fine. IE 720p24 is ok for playback as long as its full frame video.

    Tivo will handle anamorphic video at 480i but I was never 100% successful in predicting the behaviour. I gave up and encoded everything to non-anamorphic. Either 720x480 or 1280x720 depending on the source.
     
  8. txporter

    txporter One sec, almost done

    666
    0
    Sep 17, 2006
    Austin, TX
    Odd. I encode all of my videos as anamorphic 480i without issue on TivoHD or Premiere. I use command line for all of my encoding though, avisynth+x264 & mp4box for muxing.

    For 4:3 video (like Star Trek TNG), I use a --sar setting of 10:11 in the x264 command line.

    For 16:9 video (like most modern TV shows: Dexter, Mad Men, etc), I use a --sar setting of 40:33 in the x264 commandline.

    These are all DVD rips. 4:3 shows up with pillars, 16:9 is fullscreen.
     
  9. wmcbrine

    wmcbrine Well-Known Mumbler

    11,653
    786
    Aug 2, 2003
    Any DVD video should play fine without reencoding (even on a Series 2). There are no real 60 fps DVDs, it's just a difference in how it's reported (30 frames vs. 60 fields).
     

Share This Page