1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

mp4 transcoding appears to be eliminated

Discussion in 'TiVo Home Media Features & TiVoToGo' started by larry99, Feb 18, 2009.

  1. Dan203

    Dan203 Super Moderator Staff Member TCF Club

    38,866
    689
    Apr 17, 2000
    Nevada
    What about integrating an MP4 muxer into pyTiVo so that any file with the proper audio and video type is remuxed into a proper MP4 container and that stream is push through to the TiVo?

    What does pyTiVo do now if it finds a properly encoded MPEG-2 file in the wrong container? For example an MPEG-2 transport stream? Does it have to transcode? Or does it simply repackage the stream into a program stream and pass it over to the TiVo?

    Dan
     
  2. tchescat2000

    tchescat2000 New Member

    5
    0
    Jul 5, 2002
    Well I just downloaded the newest pytivo and tried to import one of my mkv files 1080p w/DTS and the debug log says: pyTivo.video.transcode: (False, 'TRANSCODE=YES, vCodec h264 not compatible.'), m:\movies\movie1080pDTS.mkv

    Why vCodec h264 not compatible?
     
  3. westside_guy

    westside_guy Annoyingly ephemeral

    464
    1
    Mar 13, 2005
    The soggy...
    If you pull it down to the Tivo the usual way, it'll still get transcoded to mpeg2. You have to "push" it from your computer, using the web interface, to get the native mp4.
     
  4. tchescat2000

    tchescat2000 New Member

    5
    0
    Jul 5, 2002
    I tried the push way of doing it and the debug log says the same thing, but it doesn't transfer at all that way. It shows up on the Tivo list as transfering, but nothing is really transfering.
     
  5. moyekj

    moyekj Well-Known Member

    11,336
    119
    Jan 23, 2006
    Mission...
    When you say you pulled down the latest version, did you get wmcbrine's latest zip file from here?
    http://repo.or.cz/w/pyTivo/wmcbrine.git?a=snapshot;h=ed44e2300bccffa075afb422a00213b8275324de;sf=zip
    i.e. You should get it from latest zip file here:
    http://repo.or.cz/w/pyTivo/wmcbrine.git
     
  6. tchescat2000

    tchescat2000 New Member

    5
    0
    Jul 5, 2002
    That is where I got it and that is what version I am running. Also:

    I tried a mkv that is not using DTS and pushed it and got the following:

    2009-02-24 18:27:42,707 DEBUG pyTivo.video.transcode: (True, 'TRANSCODE=NO, passing through mp4.'), m:\movies\\movie2.mkv
    2009-02-24 18:27:42,707 DEBUG pyTivo.video.transcode: m:\movies\\movie2.mkv is tivo compatible
    2009-02-24 18:27:42,707 DEBUG pyTivo.video.qt-faststart: ftyp atom not found, is this a valid MOV/MP4 file?

    And nothing transfers. Doesn't even show up in the now playing.
     
  7. kearygriffin

    kearygriffin New Member

    346
    0
    Jan 31, 2008
    I just did some testing with MKV files, and could not get a push to work with any MKV's. The only pushes that worked were MKV files that were not h264 (so they transcoded).

    I did make a mistake in the qtfaststart stuff that made testing this a little harder (it was throwing an exception when mkv files where put thru qtfaststart, I think moyekj pointed this out earlier) It was supposed to copy the file raw if it had problems parsing it. I am attaching a patch to fix this.

    All of the MKV's I tried where h264/ac3 so someone else may want to try h264/aac, but I really have my doubts that TiVo is supporting MKV files natively at the moment.
     

    Attached Files:

  8. moyekj

    moyekj Well-Known Member

    11,336
    119
    Jan 23, 2006
    Mission...
    That make sense now. With only DTS audio the mp4 compatible check fails and hence transcode to mpeg2 is enabled. With the other sample with non-DTS audio the mp4 compatible check passes but then qtfaststart code is trying to parse an mkv container which fails and throws exception.
    I'm pretty convinced at this point that mkv container is NOT supported natively anyway so there is not much point trying to patch things to allow mkv containers to go through (bypassing qtfaststart).

    EDIT: I see Keary beat me in posting but I'll leave my message anyway...
    To clarify now with Keary's patch qtfaststart will be effectively bypassed so now pyTivo will pass the mkv file along to Tivo, but I'm pretty sure you will find the transfer will fail with an exception like "connection closed by peer "- peer being Tivo rejecting the stream in this case).
     
  9. moyekj

    moyekj Well-Known Member

    11,336
    119
    Jan 23, 2006
    Mission...
    Keary, did you ever experiment native streaming of mkv files with streambaby? From what I recall I believe streambaby currently transcodes mkv to mpeg2 right? I think I may have tried a long while ago with tivostream and found mkv didn't stream natively but I think I was trying to use video/mp4 mime and never tried other mime types such as video/mkv. I'm pretty sure it won't work but just curious if you experimented much at all...
     
  10. kearygriffin

    kearygriffin New Member

    346
    0
    Jan 31, 2008
    I don't think so, but I just gave it a shot with
    video/x-matroska
    And got an unsupported stream type error from the Tivo.

    It's pretty easy to test out new formats with streambaby.
    If you copy (or rename) the file to "filename.raw", and then create a text file called "filename.raw.fmt" with the first line the mimeType, and the second line the contentType: to send to the TiVo, streambaby will give it a whirl. I just tried an MKV with both mime and contentype set to video/x-matroska.

    Edit: I am assuming video/x-matroska is correct, as it's what I see referenced most often on the web.
     
  11. moyekj

    moyekj Well-Known Member

    11,336
    119
    Jan 23, 2006
    Mission...
    OK thanks. So I think the bottom line is AFAWK mkv container is NOT supported. Dan's suggestion earlier on seems to be the next best plausible way of doing it:
    use ffmpeg to change container to mp4 if h.264 video & compatible audio stream is detected. That would handle mkv and other non mp4 containers.

    One potential complication with that approach however is that one can't just pipe the output of ffmpeg to qtfaststart since with ffmpeg remux I think the moov atom always goes at the end of the file. So one would have to wait until the ffmpeg remux finishes, then send it to qtfaststart and then initiate the push... not too pretty.
     
  12. kearygriffin

    kearygriffin New Member

    346
    0
    Jan 31, 2008
    The other complicating issue, and maybe it's just me, but I inevitably have audio/video sync issues when I try to do a straight demux/remux to another container format.
     
  13. moyekj

    moyekj Well-Known Member

    11,336
    119
    Jan 23, 2006
    Mission...
    True, so probably restricting native h.264 push to mp4 container only is the easiest way to go right now short of a reliable alternative. Everything else gets pushed as mpeg2. That's still a big leg up on Tivo Desktop Plus push which doesn't support AC3 audio with h.264.
     
  14. euckersw

    euckersw New Member

    23
    0
    Jan 30, 2004
    Ugh - I've been duped and I'm sorry. I thought I was able to stream mkv files without transcoding and in my excitement I never checked the log. Sure enough, the files were being transcoded. I'm sorry if I got anybody's hopes up. I'll go curl up under a rock again...
     
  15. Rdian06

    Rdian06 New Member

    463
    0
    Apr 12, 2008
    Are you using ffmepg to remux? If so try adding the -copyts flag to preserve the timestamps. This is what fixed the sync issues for transcoding mkv to vob in the pyTivo code.

    I've been trying to use ffmpeg to remux some of my mkvs to mp4s, but something with my ffmpeg build isn't quite working. It keeps complaining about a failure to set frame size for the ac3 audio stream. Have to try a newer ffmpeg SVN to see if that fixes it.
     
  16. Rdian06

    Rdian06 New Member

    463
    0
    Apr 12, 2008
    So I've been meaning to ask, exactly how does streambaby handle the moov atom issue? Can any of that work be leveraged to precompute the moov atom and send it before finishing the remux to mp4?
     
  17. moyekj

    moyekj Well-Known Member

    11,336
    119
    Jan 23, 2006
    Mission...
    Keary should answer that question, but remember for streambaby case you are starting from a pre-existing mp4 so the moov atom is readily available to be extracted and sent at the head of the stream. In this case the moov atom is not available until the ffmpeg remux completes. (streambaby currently will transcode to mpeg any mkv file).

    Good tip on the -copyts option. I wasn't aware of such a thing.
     
  18. moyekj

    moyekj Well-Known Member

    11,336
    119
    Jan 23, 2006
    Mission...
    I just confirmed that surprisingly Tivo rejects mp2 and mp3 audio with combination of h.264 video in mp4 container. So basically looks like AC3 & AAC audio only.
     
  19. euckersw

    euckersw New Member

    23
    0
    Jan 30, 2004
    How do we apply this patch (not sure where to cut and paste the attached code)? Thanks.
     
  20. wmcbrine

    wmcbrine Ziphead

    10,437
    55
    Aug 2, 2003
    Don't bother, just get it from my fork.
     

Share This Page