# Best way to get H.264 (MKV) 1080 videos onto HD Tivo with pyTivo?



## Spenner

What's the highest-quality way to get H.264 MKV 1080p rips (avc1, 24fps, bitrates approx 8K-10K) to Tivo using pyTivo?

I've been letting pyTivo transcode them to mpeg, where the ffmpeg parameters are:
*-vcodec mpeg2video -b 20971k -maxrate 30000k -bufsize 8388k -acodec ac3 -ab 448k -ar 48000 -f vob*

Lately I've read that pyTivo can _push_ H.264. Would I get a higher-quality end result if I pushed the MKV H.264 files instead? If so what ffmpeg parameters would I need?

Thanks


----------



## moyekj

Here's the specs for videos that you can push natively to Tivos (without need to transcode).
http://code.google.com/p/streambaby/wiki/video_compatibility

H.264 must be level 4.1 or lower which *may* not be the case for Blu Ray rips. Also, container must be mpeg4 and audio must be AC3 or AAC and can't exceed the specs noted on that page. i.e. Tivo decoder supports only a narrow range of specs which may not be suitable for a lot of Blu Ray rips, so you may be better off just using the transcoding method you are using now.


----------



## jcthorne

For 'most' MKVs, if you will re-mux them into an mp4 container and convert the audio to AC3 at 448kbps, they will transfer natively, transfer MUCH more quickly and play at higher quality than conversion to mpeg2 for transfer.


----------



## qz3fwd

Do you mean transfer natively through Tivo Desktop Plus?
I also want to experiment with transferring a mkv to my S3 tonight.


----------



## moyekj

qz3fwd said:


> Do you mean transfer natively through Tivo Desktop Plus?
> I also want to experiment with transferring a mkv to my S3 tonight.


 TD+ will not natively transfer mp4+H.264+AC3 (it only likes/accepts AAC audio). You have to use pyTivo "push" for that to work.


----------



## ajayabb

jcthorne said:


> For 'most' MKVs, if you will re-mux them into an mp4 container and convert the audio to AC3 at 448kbps, they will transfer natively, transfer MUCH more quickly and play at higher quality than conversion to mpeg2 for transfer.


Which program do you use to remux Mkv to MP4? I tried Handbrake but it reencodes the entire video rather than remuxing.


----------



## orangeboy

ajayabb said:


> Which program do you use to remux Mkv to MP4? I tried Handbrake but it reencodes the entire video rather than remuxing.


Would VLC do that for you?


----------



## jcthorne

The attached file is a batch file that another user put together for doing the conversion. There are a few utilities required (all free) called out in the first few lines of the code.

Workes very well, does not reencode just demuxes, converts audio and remuxes into an mp4.


----------



## bkdtv

moyekj said:


> TD+ will not natively transfer mp4+H.264+AC3 (it only likes/accepts AAC audio). You have to use pyTivo "push" for that to work.


This is no longer the case, as far as I can tell.

TiVo Desktop Plus 2.8 natively transfers MP4 (H.264) files with AC3 audio.

I've been using Yamb 2.1b2 to save MKV files with AAC and DD5.1 audio as MP4 files. [This won't work for MKV files with DTS or >448Kbps DD5.1.] To do that, you click the Creation -> Click to Create a MP4 file... menu, and select the MKV file. It's simple and fast.

_Notes for those installing Yamb: Choose custom setup in the Yamb installer and check mkvextract. If you get an error about a missing regex.dll, you can download that here and place it in the mkvextract subfolder in the Yamb installation directory. If using Windows 7, sure to install the Yamb program to a folder where you have permissions to write, such as a subfolder in your Users folder (ex: My Documents or Desktop). _


----------



## orangeboy

bkdtv said:


> This is no longer the case, as far as I can tell.
> 
> TiVo Desktop Plus 2.8 natively transfers MP4 (H.264) files with AC3 audio.
> 
> I've been using Yamb 2.1b2 to save MKV files with AAC and DD5.1 audio as MP4 files. [This won't work for MKV files with DTS or >448Kbps DD5.1.] To do that, you click the Creation -> Click to Create a MP4 file... menu, and select the MKV file. It's simple and fast.
> 
> _Notes for those installing Yamb: Choose custom setup in the Yamb installer and check mkvextract. If you get an error about a missing regex.dll, you can download that here and place it in the mkvextract subfolder in the Yamb installation directory. If using Windows 7, sure to install the Yamb program to a folder where you have permissions to write, such as a subfolder in your Users folder (ex: My Documents or Desktop). _


I downloaded Yamb and used it only once. Not because I didn't like it, but I wanted a command line utility so I could do some automation. Yamb to the rescue! In the log file, it documented the commands that it used to produce an mp4 file by first calling mkvextract, then muxing the resulting audio and video streams into an mp4 container using mp4box. Copied/Pasted those lines into a bat file, then surrounded them with some ffmpeg information parsing and file existence logic and I'm all set.

I got the idea from jcthorne's batch, but found it just a little too interactive for automating. The files transfer much, MUCH faster, and are playable while downloading.


----------



## spocko

bkdtv said:


> TiVo Desktop Plus 2.8 natively transfers MP4 (H.264) files with AC3 audio.


Are you talking about the TD auto transfer feature (i.e. push) or file transfers initiated from the Tivo (pull)?


----------



## bkdtv

spocko said:


> Are you talking about the TD auto transfer feature (i.e. push) or file transfers initiated from the Tivo (pull)?


Push (auto transfer folders).

Unless something has changed recently, you can't initiate H.264 transfers with pull.


----------



## spocko

bkdtv said:


> Push (auto transfer folders).
> 
> Unless something has changed recently, you can't initiate H.264 transfers with pull.


That's what I thought. Just wanted to make sure I hadn't missed some new capability. Thanks.


----------



## jcthorne

orangeboy said:


> I downloaded Yamb and used it only once. Not because I didn't like it, but I wanted a command line utility so I could do some automation. Yamb to the rescue! In the log file, it documented the commands that it used to produce an mp4 file by first calling mkvextract, then muxing the resulting audio and video streams into an mp4 container using mp4box. Copied/Pasted those lines into a bat file, then surrounded them with some ffmpeg information parsing and file existence logic and I'm all set.
> 
> I got the idea from jcthorne's batch, but found it just a little too interactive for automating. The files transfer much, MUCH faster, and are playable while downloading.


Would you mind posting your batch file?


----------



## orangeboy

jcthorne said:


> Would you mind posting your batch file?


The more I look at the batch file I uploaded, the less I am happy with it. I've got too many things taken for granted (audio/video track id's for one). I'll put up something I am happy with, if it's possible for me to ever create one. 

Attachment removed...


----------



## orangeboy

jcthorne said:


> The attached file is a batch file that another user put together for doing the conversion. There are a few utilities required (all free) called out in the first few lines of the code.
> 
> Workes very well, does not reencode just demuxes, converts audio and remuxes into an mp4.


When using mp4creator, do you get (and live with) the message: "Error decoding sei message"?


----------



## jcthorne

orangeboy said:


> When using mp4creator, do you get (and live with) the message: "Error decoding sei message"?


Yes. In this case just ignor it.


----------



## orangeboy

jcthorne said:


> Yes. In this case just ignor it.


Thanks - 
I just updated post 15 of this thread, BTW.


----------



## orangeboy

jcthorne said:


> Would you mind posting your batch file?


I took another crack at it, and came up with something I'm much more satisfied with. Please see the attached txt file. It accepts a single file or multiple files as arguments. I'm using eac3to to better determine video file information, things ffmpeg didn't report. eac3to also helped with track identification, and the creation of variables. DTS tracks and any audio bitrate greater than "448" are accounted for, as well as any audio with channels greater than 5.1.

Again, the 3 external programs (eac3to, mkvextractor, and mp4creator) and any required dll's are located in my %path% so I'm just calling the program name, but fully qualifying their paths (as I've done with cURL in the push example below) is always an option. I have both stdout and stderr being echoed to the console which can be removed, but I like to see the progress bars the programs produce. It has "restart" logic built in, so if extraction successfully takes place, but mp4 creation fails, the extraction is not required if the batch job is run again.

I was thinking that it wouldn't take much at all to add a cURL step to request pyTivo to push the generated mp4 files to a TiVo DVR, but I didn't add it to this batch due to many variances in people's container definitions. I will however post what works for me:


Code:


@ECHO off
SetLocal EnableDelayedExpansion
SET tsn=%1
SHIFT

:Loop
IF "%~1"=="" GOTO Done
FOR /F "tokens=3-5 delims=\" %%A IN ("%~f1") DO (
   SET container=%%A
   SET container=!container: =+!
   SET show=%%B
   SET show=!show: =+!
   IF NOT "%%C"=="" (
      SET episode=%%C
      SET episode=!episode: =+!
      SET show=!show!/!episode!
   )
)
"C:\Program Files\cURL\curl.exe" -d "Command=Push&Container=!container!&File=/!show!&tsn=%tsn%" "http://media-center:9032/TivoConnect?" >>CON 2>&1
SHIFT
GOTO Loop

:Done
EXIT /B

The above works for me because of my directory names and structure (represented by "tokens=3-5") match my pyTivo container names. It's more to show how to use cURL to interact with pyTivo in a batch environment.


----------



## jcthorne

This is great! But I think I ran into a bug. Converting a file that conatains a DTS audio track which it correclty identified but when reencoding the audio, it does not correctly determine the bitrate as >448 (in my case the DTS rate was 1509kbps) so the reencode used the defalut -libAften rate of 640kbps which is not tivo compatible. Could you take a look, this batch file is far more useful than the one I had been using.


----------



## orangeboy

jcthorne said:


> This is great! But I think I ran into a bug. Converting a file that conatains a DTS audio track which it correclty identified but when reencoding the audio, it does not correctly determine the bitrate as >448 (in my case the DTS rate was 1509kbps) so the reencode used the defalut -libAften rate of 640kbps which is not tivo compatible. Could you take a look, this batch file is far more useful than the one I had been using.


Yes, I see the problem. Delayed Expansion will be the death of me! Changing %eac3to_parms% to !eac3to_parms! should fix the problem. However, I did discover another bug relating to File Size comparisons. Because Windows is limited to 32 bit precision, I cheat and truncate the filesizes down to 9 digits. Doing so causes problems when an input file greater than 1GB produces an output file 100MB or greater and fails. I'm in the process of trying to find a better way of doing error checking, and I will update when I've made progress.

EDIT: Attached should have the known bugs remedied. The variable names have been modified to be more aligned, eac3to_parms should now reflect accurate information, and file size comparison (however kludgey and far from precise) is functioning. Let me know if you run into any problems! Will be updating shortly...


----------



## Spenner

Orangeboy (first, thanks), when I run your batch, I get the error message:
*mp4creator: unknown file type*
at the step where it adds the ac3 track to the mp4.


----------



## orangeboy

Spenner said:


> Orangeboy (first, thanks), when I run your batch, I get the error message:
> *mp4creator: unknown file type*
> at the step where it adds the ac3 track to the mp4.


Is this for dts or ac3 audio in the mkv file?

Also, since the mp4creator step failed, what files are leftover in the source directory? *.h264 & *.ac3?


----------



## Spenner

orangeboy said:


> Is this for dts or ac3 audio in the mkv file?


AC3, 640kbps



orangeboy said:


> Also, since the mp4creator step failed, what files are leftover in the source directory? *.h264 & *.ac3?


I rem'd your lines that delete the intermediate files, so it left *.h264, *.ac3, *.eac.

Also on the line:
IF "%ac3_kbs%" GTR "448" (
the variable should be ac3_kb*p*s. It was skipping the step to convert to 448k.

Here's all the output from the batch:

Gathering file information. Please wait...

1: h264/AVC, English, 720p23.976 (16:9) 
2: AC3, English, 5.1 channels, 640kbps, 48khz, 10ms 
3: Subtitle (SRT), English

Video and audio codecs are compatible.
Starting extraction process using these parameters:

mkvextract tracks "sample.mkv" 1:"sample.h264" 2:"sample.eac"

Extracting track 1 with the CodecID 'V_MPEG4/ISO/AVC' to the file 'sample.h264'. Container format: AVC/h.264 elementary stream

Extracting track 2 with the CodecID 'A_AC3' to the file 'sample.eac'. Container format: Dolby Digital (AC3)

Progress: 100%

The audio track will be made TiVo compliant using these parameters:
eac3to.exe "sample.eac" "sample.ac3" -448

AC3, 5.1 channels, 0:01:05, 640kbps, 48khz 
The Nero decoder doesn't seem to work, will use libav instead. 
Decoding with libav/ffmpeg... 
Remapping channels... 
Encoding AC3 <448kbps> with libAften... 
Creating file "sample.ac3"... 
eac3to processing took 1 second. 
Done

Extracted audio and video tracks found.
Combining to create MP4 file using these parameters:
mp4creator -create="sample.h264" -rate=23.976 -use64bits -optimize "sample.mp4"
*mp4creator -create="sample.ac3" -optimize "sample.mp4"

mp4creator: unknown file type
*
Comparing source filesize: 49121625 with output filesize: 43920960

Generated mp4 file is within acceptable file size.
Deleting any workfiles.

End time for "sample.mkv"
13:21:09.61


----------



## orangeboy

Spenner said:


> ...Also on the line:
> IF "%ac3_kbs%" GTR "448" (
> the variable should be ac3_kb*p*s. It was skipping the step to convert to 448k.


That's just sloppy and embarrassing on my part. :down:



Spenner said:


> ...The audio track will be made TiVo compliant using these parameters:
> eac3to.exe "sample.eac" "sample.ac3" -448
> 
> AC3, 5.1 channels, 0:01:05, 640kbps, 48khz
> The Nero decoder doesn't seem to work, will use libav instead.
> Decoding with libav/ffmpeg...
> Remapping channels...
> Encoding AC3 <448kbps> with libAften...
> Creating file "sample.ac3"...
> eac3to processing took 1 second.
> Done
> ...


It looks like everything is being passed correctly. 
What versions of software are you running?

I'm using:
mp4creator - mpeg4ip version 1.6.1d (mp4creator -version)
mkvextract v2.9.9 ('Tutu') built on Nov 25 2009 21:13:54 (mkvextract --version)
eac3to v3.16, freeware by madshi.net (just eac3to)

I'm going to put up another copy that add -timescale to the mp4creator video step. I noticed the audio and video were out of sync, and I hope adding this parm will take care of that...


----------



## Spenner

orangeboy said:


> What versions of software are you running?
> 
> I'm using:
> mp4creator - mpeg4ip version 1.6.1d (mp4creator -version)
> mkvextract v2.9.9 ('Tutu') built on Nov 25 2009 21:13:54 (mkvextract --version)
> eac3to v3.16, freeware by madshi.net (just eac3to)


Aha, I updated my mp4creator from 1.5 to 1.6.1d and that fixed it.


----------



## orangeboy

Spenner said:


> Aha, I updated my mp4creator from 1.5 to 1.6.1d and that fixed it.


That's great! I suggest holding off doing much more until I can get the "timescale" version uploaded. I've got the parm added, and I'm running a file through it now. It shouldn't take much longer before it's done...


----------



## orangeboy

Question: When given multiple audio tracks, ac3 & dts, would the preference to be use the ac3 track for faster processing (potentially no eac3to to do) or go for the dts which may provide more channels & a higher bitrate, but at the cost of time?


----------



## orangeboy

Why is this?:

C:\> IF "1509" GTR "448" (ECHO TRUE) ELSE (ECHO FALSE)
FALSE


----------



## Rdian06

orangeboy said:


> Why is this?:
> 
> C:\> IF "1509" GTR "448" (ECHO TRUE) ELSE (ECHO FALSE)
> FALSE


I believe it's doing an alphabetic string comparison ( Ascii "1" < Ascii "4" ) rather than a numeric comparison.


----------



## Rdian06

Ah, according to "help if":



Code:


These comparisons are generic, in that if both string1 and
string2 are both comprised of all numeric digits, then the strings are
converted to numbers and a numeric comparison is performed.

By wrapping the values in quotes, you forced the values to be string compared rather than number compared.

This will give you want you want:



Code:


IF 1509 GTR 448 (ECHO TRUE) ELSE (ECHO FALSE)
TRUE


----------



## bsmith1051

This is a great discussion, thank you! Hopefully these scripts (I'm currently using the earlier 'mkv2mp4tivo') can be posted to a new sticky, as they're crucial to making these various PC-to-Tivo programs work smoothly.


----------



## Rdian06

orangeboy said:


> Question: When given multiple audio tracks, ac3 & dts, would the preference to be use the ac3 track for faster processing (potentially no eac3to to do) or go for the dts which may provide more channels & a higher bitrate, but at the cost of time?


It depends on the movie. In some cases I've found the sound on a DTS to AC3 transcode better. And other times I've found that high bitrate AC3 (Dolby Digital Plus) transcoded to 448k AC3 is better than the DTS track (it seemed to spaitialize better.)

It just depends on how well the mix was done.


----------



## orangeboy

Rdian06 said:


> I believe it's doing an alphabetic string comparison ( Ascii "1" < Ascii "4" ) rather than a numeric comparison.


It's frustrating because I'm using a variable that may or may not be defined on the comparison. If I remove the quotes, true numeric comparison is made, but if the variable isn't defined, I get an error because the equations isn't complete. An example of an undefined variable in the equation:

C:\> IF GTR 448 (ECHO TRUE) ELSE (ECHO FALSE)
448 was unexpected at this time.

Thanks for the explanation...

I added more code to set a value of zero if the var is undefined. Seems unnecessary, but required...


----------



## orangeboy

I ran through ½ dozen dts and ½ dozen ac3 clips - some at 720p, some 1080p, and I have found no problems. At this time, dts is the preferred track if both dts and ac3 tracks are found in the video file. A critical parameter "timescale" for mp4creator was added to keep the audio and video in sync. I believe the necessary parameters for eac3to are being provided when needed - if the audio doesn't need touched, it isn't.

Thanks to jcthorne for providing an example!

<attachment removed>


----------



## orangeboy

Rdian06 said:


> It depends on the movie. In some cases I've found the sound on a DTS to AC3 transcode better. And other times I've found that high bitrate AC3 (Dolby Digital Plus) transcoded to 448k AC3 is better than the DTS track (it seemed to spaitialize better.)
> 
> It just depends on how well the mix was done.


Those are good points. That raises a question in my mind: why do I have "Override_aKbps : 1024" in my default.txt (metadata) for my mkv files? I mean I know why I have it there: it fixes cyclical audio dropouts with some files. But will I be shorting myself by capping @448k in my batch if 1024k is an "allowable" value? Or am I not interpreting this value correctly?


----------



## wmcbrine

You're not. "Override_aKbps: 1024" basically just means "reencode the audio, period". The TiVo cannot actually handle greater than 448 Kbps -- which is _why_ that line forces a reencode. The Override_ parameters override the detected values for the source file; they don't control the output stream directly.

For example, on a file with a 384 Kbps AC3 audio track, normally pyTivo would note that 384 is less than 448, and pass the audio through without reencoding it. But with the Override_ line, it thinks the original audio track is 1024 Kbps, which is greater than 448, so it has to reencode it (to 448 -- you don't alter that value with an Override_ line). Note that 512 would've worked just as well, or 2000, or 20000.


----------



## orangeboy

wmcbrine said:


> You're not. "Override_aKbps: 1024" basically just means "reencode the audio, period". The TiVo cannot actually handle greater than 448 Kbps -- which is _why_ that line forces a reencode. The Override_ parameters override the detected values for the source file; they don't control the output stream directly.
> 
> For example, on a file with a 384 Kbps AC3 audio track, normally pyTivo would note that 384 is less than 448, and pass the audio through without reencoding it. But with the Override_ line, it thinks the original audio track is 1024 Kbps, which is greater than 448, so it has to reencode it (to 448 -- you don't alter that value with an Override_ line). Note that 512 would've worked just as well, or 2000, or 20000.


Gotcha. I interpreted it to be "please make audio bitstream 1024kbps". Thanks for the explanation!


----------



## rmerikle

I first got the error missing libaften.dll and now it tells me I am missing libflac.dll Are there any other pieces I should install to make this bat work? Is there some type of package I am missing? If I could get this to work this is exactly what I have been looking for. Thanks!


----------



## orangeboy

rmerikle said:


> I first got the error missing libaften.dll and now it tells me I am missing libflac.dll Are there any other pieces I should install to make this bat work? Is there some type of package I am missing? If I could get this to work this is exactly what I have been looking for. Thanks!


You will need to have three external programs (and their supporting dll's) available to the batch:

mvkextract.exe - used to extract separate audio and video tracks from the source mkv container
eac3to.exe - used to manipulate/modify certain aspects of the extracted audio file (if needed)
mp4creator.exe - used to combine the separate audio and video tracks into a single file mp4 container.

I've stated earlier that I keep a "user" directory located at C:\path where I keep those programs and batch files, and it is defined in my system's %path% environment variable. This allows me to execute any of those programs from a command line from any drive and/or directory.

I also take advantage of my Sendto folder (found at %homepath%\SendTo) to allow "groups" of files to be sent to a batch file. For example, I have a shortcut in my SendTo folder that points to this batch file (on my system, I called it "make.tivo.mp4.bat"). I can then use Windows Explorer to find then select a bunch of .mkv files > right click > SendTo > make.tivo.mp4.bat. Each of the selected files will be passed to and processed by "make.tivo.mp4.bat". This way I don't have to sit at a command line and type make.tivo.mp4.bat "some.video.filename.mkv" for every file I want to convert. I also have shortcut(s) to Push.To.TiVo.bat (which uses cURL) in my SendTo that gives me the same ability to pyTivo push a bunch of files to any of the TiVo DVRs on my network.

I actually automatically push the resulting mp4 file to a TiVo DVR named TivoS3 in my "make.tivo.mp4.bat" file, by adding the first two lines of the following code:


Code:


[COLOR="Red"]ECHO Pushing %OutputFullPath%
CALL Push.To.Tivo TivoS3 "%OutputFullPath%"[/COLOR]

ECHO End time for "%SourceFullName%"
ECHO %TIME%

SHIFT
GOTO Loop

Hope this helps out and gives you some ideas on how to use this!


----------



## rmerikle

I think I am starting to get there. Thank you very much for all this work. I am now getting both these possible error messages....

This doesn't seem to be a valide EVO/VOB file ($0)

And

'pytivometathis' is not recognized as an internal or external command

Here is the log

eac3to v3.17
command line: eac3to.exe G:\Blu-Ray\convert\tmpvidce.ac3 G:\Blu-Ray\convert\tmpvidce2.ac3 -448 -libav
------------------------------------------------------------------------------
This doesn't seem to be a valid EVO/VOB file ($0). <ERROR>
DTS, 5.1 channels, 1:58:00, 24 bits, 1509kbps, 48khz, dialnorm: -6dB
Removing DTS dialog normalization...
Decoding with libav/ffmpeg...
Remapping channels...
Encoding AC3 <448kbps> with libAften...
Creating file "G:\Blu-Ray\convert\tmpvidce2.ac3"...
Clipping detected, a 2nd pass will be necessary. <WARNING>
Starting 2nd pass...
Removing DTS dialog normalization...
Decoding with libav/ffmpeg...
Remapping channels...
Encoding AC3 <448kbps> with libAften...
Creating file "G:\Blu-Ray\convert\tmpvidce2.ac3"...
eac3to processing took 7 minutes, 16 seconds.
Done.

The file plays, but has no sound. This may be due to the player I am using is not decoding the sound? I'll transfer the file and see if the Receiver can decode the sound. 32 Gig file. Now that is large!


----------



## rmerikle

Also might add with Windows 7 you need to have write permission to the temp file. This took me a few trys to figure out.


----------



## orangeboy

rmerikle said:


> I think I am starting to get there. Thank you very much for all this work. I am now getting both these possible error messages....
> 
> This doesn't seem to be a valide EVO/VOB file ($0)
> 
> And
> 
> 'pytivometathis' is not recognized as an internal or external command
> 
> Here is the log
> 
> eac3to v3.17
> command line: eac3to.exe G:\Blu-Ray\convert\tmpvidce.ac3 G:\Blu-Ray\convert\tmpvidce2.ac3 -448 -libav
> ------------------------------------------------------------------------------
> This doesn't seem to be a valid EVO/VOB file ($0). <ERROR>
> DTS, 5.1 channels, 1:58:00, 24 bits, 1509kbps, 48khz, dialnorm: -6dB
> Removing DTS dialog normalization...
> Decoding with libav/ffmpeg...
> Remapping channels...
> Encoding AC3 <448kbps> with libAften...
> Creating file "G:\Blu-Ray\convert\tmpvidce2.ac3"...
> Clipping detected, a 2nd pass will be necessary. <WARNING>
> Starting 2nd pass...
> Removing DTS dialog normalization...
> Decoding with libav/ffmpeg...
> Remapping channels...
> Encoding AC3 <448kbps> with libAften...
> Creating file "G:\Blu-Ray\convert\tmpvidce2.ac3"...
> eac3to processing took 7 minutes, 16 seconds.
> Done.
> 
> The file plays, but has no sound. This may be due to the player I am using is not decoding the sound? I'll transfer the file and see if the Receiver can decode the sound. 32 Gig file. Now that is large!


Were there success/failure messages in the extraction step? Seeing "Clipping detected, a 2nd pass will be necessary. <WARNING>" tends to make me think the source file isn't complete...


----------



## orangeboy

wmcbrine said:


> You're not. "Override_aKbps: 1024" basically just means "reencode the audio, period". The TiVo cannot actually handle greater than 448 Kbps -- which is _why_ that line forces a reencode. The Override_ parameters override the detected values for the source file; they don't control the output stream directly.
> 
> For example, on a file with a 384 Kbps AC3 audio track, normally pyTivo would note that 384 is less than 448, and pass the audio through without reencoding it. But with the Override_ line, it thinks the original audio track is 1024 Kbps, which is greater than 448, so it has to reencode it (to 448 -- you don't alter that value with an Override_ line). Note that 512 would've worked just as well, or 2000, or 20000.


OK, I've got an mp4 file with these attributes:


Code:


Track   Type    Info
1       video   H264 [email protected], 3007.041 secs, 3775 kbps, 1280x720 @ 24.000005 fps
2       audio   ac-3, 3010.112 secs, 384 kbps, 48000 Hz

and the audio still skips! Is the DVR looking for 448 kbps specifically? It was my assumption that anything >448 was bad, but now I'm thinking anything <>448 needs "adjusting"...


----------



## wmcbrine

No, there's nothing wrong with 384 Kbps, as far as the TiVo is concerned. There's just something wrong with _that specific track_.

Or not. Sometimes the audio just gets weird, and I can clear it up by playing something else first.


----------



## jcthorne

its your FPS in the file. Tivo plays 23.976, 30 and 60fps natively. All others must be resampled for display. The broadcom chip is better at some than others and worse at higher resolutions. For HD, I strongly suggest picking one of the native fps numbers before sending to Tivo. Others will work SOMETIMES depending on the moon phase, and the time of the month....

Also noted is your two tracks show as different length so they do not interleave correctly, the tivo will skip frames in one track or the other, thus your skipping.


----------



## orangeboy

Thanks guys!


----------



## wmcbrine

jcthorne said:


> its your FPS in the file. ... Also noted is your two tracks show as different length


Ah, good catch. I wonder if the video is actually 23.97 fps, just mislabelled as 24, since 24/23.97 * 3007 = ~3010.


----------



## rmerikle

OK been beating my head against the wall on this one. I believe I am doing everything right, but when I push the file to Tivo and try to play it the movie stutters something fierce. Here is my process....

eac3to.exe H:
**** Find number of main movie
eac3to.exe H: 1)
**** Find number of tracks that need to be extracted
eac3to.exe H: 1) 1:"D:\BlueRay\chapters.txt" 2:"D:\BlueRay\movie.h264" 3:"D:\BlueRay\sound.ac3" -448 -libav
**** Use mp4creator for fps 23.976, 64 bits and optimize
mp4creator -create=movie.h264 -rate=23.976 -timescale=23976 -use64bits -optimize finalmovie.mp4
mp4creator -create=sound.ac3 -optimize finalmovie.mp4


----------



## orangeboy

rmerikle said:


> OK been beating my head against the wall on this one. I believe I am doing everything right, but when I push the file to Tivo and try to play it the movie stutters something fierce. Here is my process....
> 
> eac3to.exe H:
> **** Find number of main movie
> eac3to.exe H: 1)
> **** Find number of tracks that need to be extracted
> eac3to.exe H: 1) 1:"D:\BlueRay\chapters.txt" 2:"D:\BlueRay\movie.h264" 3:"D:\BlueRay\sound.ac3" -448 -libav
> **** Use mp4creator for fps 23.976, 64 bits and optimize
> mp4creator -create=movie.h264 -rate=23.976 -timescale=23976 -use64bits -optimize finalmovie.mp4
> mp4creator -create=sound.ac3 -optimize finalmovie.mp4


Try switching the order of tracks, as in put the audio track first. Somebody else was having an issue with mp4 files created in a similar manner, and switching the tracks helped. If you do so, put the -use64bits in the audio track specifications.


----------



## orangeboy

I did an overhaul on the "quick and dirty" batch file I uploaded a few days ago. It now does better handling of files with multiple audio tracks through the use of a "scoring" routine. It also adjusts the framerates and timescales to NTSC standards. I don't know if PAL is supported by TiVo, but if there is a desire for it, I don't think it would be impossible to add PAL logic to this batch. Also new is language support for both audio and subtitle tracks (if present). Subtitle tracks may be useful with Stream Baby, Stream!

This batch now provides the user to setup some post-processing as well. Now after the mp4 file has been created, the ability to create metadata through the use of pyTivoMetaThis has been added, as well as the option to have the file(s) moved to a Tivo Desktop Plus "Auto Transfer" directory or to a pyTivo "Auto Push" watched directory. There is also a "user defined" option that allows for any other command/program/script to run AFTER any of the other post-processing activities have completed, and optionally having access to the variable names that this batch script has defined for use as command line arguments. The code is pretty modular, so if the user defined process needs to execute BEFORE anything else this batch file can be edited without too much trouble (lines 374-378 make up the user defined actions). The assumption is that the post-processing applications have already been installed and configured. This batch file is only a means to optionally invoke them.

Both required and user options are set through the use of a "first run" dialog. It is at this time that the audio language preference is set, as well as how the subtitle tracks are handled. The batch file tries to find the required programs: eac3to.exe, mvkextract.exe, and mp4creator.exe in the system %path%, and if found, the user has to do nothing. If they are not found, the user is prompted for the full path to the program(s). The user input is verified before writing the variable(s). After all of the required options are set, the optional settings are gathered. The user has the ability to set no post-processing if desired. Otherwise the dialog steps through the different options, requesting program names or path information as needed.

I have tried very hard to prevent mistakes from happening, but if a program path changes, or you no longer wish to create subtitle tracks (or whatever), the user specific variables are written at the very bottom of the batch file. They can either be edited to reflect new values, or completely deleted to re-run the setup dialog at the invocation of the batch file. I also tried to document the different sections and subroutines, but the documentation may still be lacking in detail.

I've been testing it using a variety of small ~50MB mkv files, as well as taking on 4-8GB files. At this time, the only problem I've encountered is optionally using pyTivoMetaThis. If the filename was somewhat ambiguous, I was prompted to specify the title. This is not an ideal situation, as this is geared more for automation. But thanks to the guidance of rdian06, this problem may have a solution: pyTivo Forum Post. Actually, thanks go to a lot of people for putting up with my questions! 

Edit - Whoops! Found a bug. If you've already downloaded that bat file, please re-download this file.


----------



## rmerikle

orangeboy said:


> Try switching the order of tracks, as in put the audio track first. Somebody else was having an issue with mp4 files created in a similar manner, and switching the tracks helped. If you do so, put the -use64bits in the audio track specifications.


Tried this. Same issue. Now to be clear this is only an issue when pushing the file and not pulling it. When I pull the file it seems to work OK, but my understanding is I am losing some quality by pulling and not pushing. Also I lose the ability to do some other things such as auto push and descriptions.

Thanks for the help and I look forward to trying your bat file.


----------



## moyekj

rmerikle said:


> Tried this. Same issue. Now to be clear this is only an issue when pushing the file and not pulling it. When I pull the file it seems to work OK, but my understanding is I am losing some quality by pulling and not pushing. Also I lose the ability to do some other things such as auto push and descriptions.
> 
> Thanks for the help and I look forward to trying your bat file.


 What's the average bit rate of the Blu Ray rip? (You can use MediaInfo to get that information or some other tools). If it exceeds 25 Mbps or so then TiVo decoder can't handle it (will play audio but video will be blank).


----------



## fyodor

I'm pretty sure this is a bitrate issue. My understanding it that the Tivo cannot handle decoding of blu-ray bitrate h.264. It works when pulling because it is transcoded to a (comparatively) lower quality MPEG-2 video.



rmerikle said:


> OK been beating my head against the wall on this one. I believe I am doing everything right, but when I push the file to Tivo and try to play it the movie stutters something fierce. Here is my process....
> 
> eac3to.exe H:
> **** Find number of main movie
> eac3to.exe H: 1)
> **** Find number of tracks that need to be extracted
> eac3to.exe H: 1) 1:"D:\BlueRay\chapters.txt" 2:"D:\BlueRay\movie.h264" 3:"D:\BlueRay\sound.ac3" -448 -libav
> **** Use mp4creator for fps 23.976, 64 bits and optimize
> mp4creator -create=movie.h264 -rate=23.976 -timescale=23976 -use64bits -optimize finalmovie.mp4
> mp4creator -create=sound.ac3 -optimize finalmovie.mp4


----------



## orangeboy

Hey - I found a bug in this batch file found in this post. It's been fixed, and I updated the post and the attachment. I included an extra set of double quotes in a temp filename, leading to "Source file not found" messages when dealing with file name with embedded spaces. Sorry for any problems this may have caused!


----------



## Spenner

Just wanted to post a THANKS to the various people who've helped out on this thread.

I've been successful in pushing some H.264 films converted from MKV to MP4 to watch on my 50"er, and I gotta say the results are great. Comparing playback of the H.264 MP4's to the pulled MPEG2's transcoded from the same source files, there's a noticable improvement in image quality.

Oh! And the bonus in transfer speed - about 20Mb/s wired, and about 12Mb/s wireless.

Wish I had gotten this going a few months earlier.

Only downside is that ff/rew isn't as smooth as with MPEG/Tivo-format recordings. And two films just hang the Tivo (length stuck at 0) when I push them - can't be cancelled, have to unplug the Tivo to kill the transfer.


----------



## txporter

Spenner said:


> Just wanted to post a THANKS to the various people who've helped out on this thread.
> 
> I've been successful in pushing some H.264 films converted from MKV to MP4 to watch on my 50"er, and I gotta say the results are great. Comparing playback of the H.264 MP4's to the pulled MPEG2's transcoded from the same source files, there's a noticable improvement in image quality.
> 
> Oh! And the bonus in transfer speed - about 20Mb/s wired, and about 12Mb/s wireless.
> 
> Wish I had gotten this going a few months earlier.
> 
> Only downside is that ff/rew isn't as smooth as with MPEG/Tivo-format recordings. And two films just hang the Tivo (length stuck at 0) when I push them - can't be cancelled, have to unplug the Tivo to kill the transfer.


Yeah, transfers of h.264 material is much faster because there is no additional repackaging on the tivo end of things. And FF/RW is always a worse with h.264 material than MPEG2, but it can be improved a little. If you encode without b-frames, the seeking seems to be smoother (although you will sacrifice some compression since b-frames are lower bitrate than I/P frames). It also seems to be better with smaller keyframe intervals. Most guides recommend blu-ray encodes use 1x the framerate, so this is likely already done for you but SD encodes are normally suggested at 5-10x framerate, so if that was used for the blu-ray encode, you might be able to get some improvement.


----------



## moyekj

Smooth FF/REW also depends on target TiVo. Original S3 model is terrible with H.264 and 1x FF/REW no matter how you encode it. THD is much better. mpeg2 is always smoother on either one as is vc-1 in wmv container.


----------



## hooper

Big Thanks!! Been looking to do this for a while now, but didn't know the format specs required.


----------



## jcthorne

Orangboy, really wish to thank you for your work on this bat file. Works very well for my needs getting files ready for tivo.


----------



## orangeboy

jcthorne said:


> Orangboy, really wish to thank you for your work on this bat file. Works very well for my needs getting files ready for tivo.


Ha! You were the one that got it started! 

Hopefully the additional application "support" will allow you to go the next step beyond just getting the files ready for the TiVo, and just pushes the final .mp4 file for you!

Something I'm curious about: I didn't really give instructions on how to use the batch file. Do you keep it somewhere in your %path% and use the command line to call it, passing an .mkv file as an argument? Or did you go with the SendTo folder shortcut option? The latter is how I implement it...


----------



## jcthorne

I have a working directory where downloads go and prepare files for tivo. I just placed the bat file there and a shortcut to the bat file on my desktop.

Now, when I get an mkv file I just drag it or a group of them to the icon and away it goes....

Not sure I am ready for the auto transfer yet as I have to stop downloading on the server while pytivo pushes or my lan card becomes unstable and locks up. Its an old laptop so I just put up with it for now. Would like to get pytivometathis working though but have had very little success with it and use metagenerator manually.


----------



## jcthorne

A few of the MKV files I get play fine, but when converted to mp4, the audio is ahead of the video. IE the audio is no longer synced. Seems to be constant through the file. Is there some sort of audio delay parameter in the mkv file that is not being translated to the mp4?


----------



## orangeboy

jcthorne said:


> A few of the MKV files I get play fine, but when converted to mp4, the audio is ahead of the video. IE the audio is no longer synced. Seems to be constant through the file. Is there some sort of audio delay parameter in the mkv file that is not being translated to the mp4?


Hmm... Could be my fault. 
I've got a section that's forcing the video framerate to NTSC standards:


Code:


:Standardize_To_NTSC_fps
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This section sets the video framerate (measured in frames per second) to  ::
:: NTSC standardized framerate values.                                       ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
SET vID=%h264_ID%
IF %numeric_frames% LEQ 25000 (
	SET vfps=23.976
	SET vtimescale=23976
	GOTO Score_Audio_Tracks
)
IF %numeric_frames% LEQ 30000 (
	SET vfps=29.970
	SET vtimescale=29970
	GOTO Score_Audio_Tracks
)
IF %numeric_frames% LEQ 60000 (
	SET vfps=59.940
	SET vtimescale=59940
	GOTO Score_Audio_Tracks
)
SET vfps=119.880
SET vtimescale=119880

There are these options for eac3to:


Code:


-slowdown          convert 25.000 and 24.000 content to 23.976 fps
-speedup           convert 23.976 and 24.000 content to 25.000 fps
-23.976/...        define source fps to be "23.976", "24.000", "25.000", ...
-changeTo24.000    change source fps to "23.976", "24.000", "25.000", ...

I'm thinking that if the framerate is greater than 23.976 by more than a few thousandths, an "eac3to_parm" should be added to "-slowdown" or "-changeto23.976" to account for film fps 24, and PAL fps 25. If I knew for certain that the TiVo could handle the non-NTSC framerates, I'd update the logic to include those, forcing _reported_ framerates of up to 23.987 down to 23.976, 24.100 down to 24.000 and 25.100 down to 25.000, to preserve the intended framerate...

Thoughts?


----------



## jcthorne

Well I suppose I would need to find or create some mp4s in those frame rates and see if they work. 

I have an mkv I am currently working with. The mkv reports a video fps of 23.976. Running it throught the bat file yields a very out of sync mp4. Hard to tell if its progressive or not but its off by more than a second at the begining of the flic. (audio is ahead of video).

Using megui to extract the h264 and ac3 streams and remux them (eac3to and mp4box) and the resultant mp4 is in sync so something is up. Ideas I might try?


----------



## splorkchop

First, thanks for this amazing script! Running batches on 16:9 TV programs is great, however The aspect on wider format video is not coming out right when I push the mp4s to the Tivo. When I try to use this on an wide format movie, it appears vertically smooshed, that is black bars on left and right. The Tivo aspect button fixes it somewhat, but its still not right. This doesn't happen when I use the Tivo to pull video from my pytivo server. Any help?


----------



## orangeboy

I'm beginning to think that mp4creator isn't the optimal tool for creating the final mp4 file.

jcthorne: What version of mp4box are you using? I've been having trouble with getting mp4box version 0.4.6-DEV (build 1 - Jun 29 2009) to successfully write the final mp4 file. It seems to create the .tmp file correctly(?) but then fails to create the mp4 file, crashing with "Faulting application mp4box.exe, version 0.0.0.0, faulting module ntdll.dll, version 5.1.2600.5755, fault address 0x00010a19."

splorkchop: Do you have ffmpeg installed? If so, executing ffmpeg -i "<your input mkv movie file>" should show more detail about the input file that is creating the "smooshed" mp4 file. Specifically, there are a couple of aspect ratio fields I'm interested in. I found this pyTivo wiki article on how it handles different aspect ratios. I see that mp4box does have a -par switch that may come in handy if ffmpeg reports a peculiar PAR. I also found this in the FAQ, explaining why your files look correct when pulled.


----------



## jcthorne

The current version of mp4box that megui uses is Kurtnoise 2009.10.13
I agree trying mp4box for this might be useful. No idea if it would work better or not. Any chance the fps manipulation you are trying to accomplish is actually making the problem worse? I notice that MeGui using mp4box to mux the tracks does not change the fps and most come out ok as far as the audio sync. The fail to mux problems seem to be much less with the current version.

I think Splorkchop's aspect ratio problem has nothing to do with the conversion. Rather he has run into an internal bug in the tivo that I have had to work around many times. If you send 720p video in an mp4 container to tivo that is less than full frame (ie 1280x544 or some such) rather than full frame (1280x720) tivo's h264 decoder incorrectly letterboxes the content. The bug was documented over a year ago during the amazon rental beta testing. All Amazon hd video is sent as full frame as a result, the bug was never fixed leading us to believe it an internal hardware issue not correctable via software. Several suggestions of explicit PAR and DAR callouts inthe the mp4 file generation have been tried and do work in a few specific instances, but not most. 1080i video does not have this problem.

There is no fix except to re-encode the video to full frame 720p. I use MeGui to pad the top and bottom with black bars to make the video 1280x720 for these videos prior to muxing to an mp4 conatiner.


----------



## wmcbrine

orangeboy said:


> I found this pyTivo wiki article on how it handles different aspect ratios.


That page is a bit dated. For Series 3/HD, most stuff is just passed through.


----------



## orangeboy

jcthorne said:


> The current version of mp4box that megui uses is Kurtnoise 2009.10.13
> I agree trying mp4box for this might be useful. No idea if it would work better or not. Any chance the fps manipulation you are trying to accomplish is actually making the problem worse? I notice that MeGui using mp4box to mux the tracks does not change the fps and most come out ok as far as the audio sync. The fail to mux problems seem to be much less with the current version.


I would like to do away with framerate manipulation (or any manipulation, for that matter), but I encountered progressively worse audio drift when not specifying a timescale when calling mp4creator. Setting standard NTSC framerates cured that for me, but seems to have to opposite effect for you.

And it seems I read somewhere that TiVo was kind of picky about framerates: 



jcthorne said:


> ...Tivo plays 23.976, 30 and 60fps natively. All others must be resampled for display. The broadcom chip is better at some than others and worse at higher resolutions. For HD, I strongly suggest picking one of the native fps numbers before sending to Tivo. Others will work SOMETIMES depending on the moon phase, and the time of the month....





jcthorne said:


> I think Splorkchop's aspect ratio problem has nothing to do with the conversion. Rather he has run into an internal bug in the tivo that I have had to work around many times. If you send 720p video in an mp4 container to tivo that is less than full frame (ie 1280x544 or some such) rather than full frame (1280x720) tivo's h264 decoder incorrectly letterboxes the content. The bug was documented over a year ago during the amazon rental beta testing. All Amazon hd video is sent as full frame as a result, the bug was never fixed leading us to believe it an internal hardware issue not correctable via software. Several suggestions of explicit PAR and DAR callouts inthe the mp4 file generation have been tried and do work in a few specific instances, but not most. 1080i video does not have this problem.
> 
> There is no fix except to re-encode the video to full frame 720p. I use MeGui to pad the top and bottom with black bars to make the video 1280x720 for these videos prior to muxing to an mp4 conatiner.


Interesting. Probably not exactly what splorkchop wants to hear, but it does sound reasonable.


----------



## splorkchop

jcthorne said:


> I think Splorkchop's aspect ratio problem has nothing to do with the conversion. Rather he has run into an internal bug in the tivo that I have had to work around many times. If you send 720p video in an mp4 container to tivo that is less than full frame (ie 1280x544 or some such) rather than full frame (1280x720) tivo's h264 decoder incorrectly letterboxes the content.


Thanks for the info...that seems to be exactly what is happening. Do you mind explaining how you use MeGUI to pad the video?


----------



## jcthorne

This is going to sound like a lot of steps but its really not that bad.

In MeGui, click tools, avs script creator. Select your video. MeGui will display the current resolution in the resize boxes. decide how many pixels wide the boarders need to be (720-current height/2)

click on the script tab and add a line to the script just below #crop to read:
AddBorders (0,96,0,96) where 96 is replaced with the number of pixesl your boarder needs to be. I saved this script as a Tivo profile so I would not have to edit every time I do one.

Click save. On the main MeGui window, input tab your avs script should be shown in the first input box. Set encoder settings to x264 Unrestricted 1 pass Const. Quality HQ
Set file format to RAWAVC

For Audio input, select your video, not the avs script. Set the encoder to Aften AC-3, 448kbps. (again I saved a profile so this is already set for me each time)

Click AutoEncode, Select MP4 for the output, ISMA for the device type. 
Click the Queue tab and start.


----------



## jcthorne

orangeboy said:


> I would like to do away with framerate manipulation (or any manipulation, for that matter), but I encountered progressively worse audio drift when not specifying a timescale when calling mp4creator. Setting standard NTSC framerates cured that for me, but seems to have to opposite effect for you.
> 
> And it seems I read somewhere that TiVo was kind of picky about framerates:
> .


I did say that. And its still true but may be the lessor of 2 evils for non compliant fps files. Tivo will attempt to play non-compliant files but the resampling it does often results in studdering video. I think perhaps the FPS being reported back by Eac3to is not always correct as I have several that show 24.xxx that when remuxed into an mp4 are reported as 23.976 without any fps changes. Perhaps Eac3to is calculating based on number of frames or some such and not the actual playback rate. Don't know. I am not being a lot of help here and have never used the CLI for mp4box so really cannot see what is being fed to it by MeGUI either. Mp4box used to be pretty buggy and fail for me about 1 out of 3 files. Latest version has been much more solid and I have not seen any failures to complete the creation of the mp4 file. Could just be the videos I have been working with the last few weeks too.


----------



## orangeboy

jcthorne said:


> I did say that. And its still true but may be the lessor of 2 evils for non compliant fps files. Tivo will attempt to play non-compliant files but the resampling it does often results in studdering video. I think perhaps the FPS being reported back by Eac3to is not always correct as I have several that show 24.xxx that when remuxed into an mp4 are reported as 23.976 without any fps changes. Perhaps Eac3to is calculating based on number of frames or some such and not the actual playback rate. Don't know. I am not being a lot of help here and have never used the CLI for mp4box so really cannot see what is being fed to it by MeGUI either. Mp4box used to be pretty buggy and fail for me about 1 out of 3 files. Latest version has been much more solid and I have not seen any failures to complete the creation of the mp4 file. Could just be the videos I have been working with the last few weeks too.


I'm definitely leery of the information reported back by eac3to; I've had it transpose track numbers twice now for the audio and video tracks, leading to a huge ac3/dts file and a small h264 file. eac3to's output is easy to parse though, much more so than ffmpeg which does seem to report more accurately some information. ffmpeg does round to 23.98 for 23.976, but I'm sure it's just a display limitation.

It seems that mp4box may not need to be told the timescale like mp4creator does. I got the latest build of mp4box, and had luck with it so far (used twice now, so not much test data yet). I'll try and put together an ffmpeg "interrogator", mkvextract, eac3to audio "manipulator" and mp4box muxer.


----------



## jcthorne

orangeboy said:


> I'm definitely leery of the information reported back by eac3to; I've had it transpose track numbers twice now for the audio and video tracks, leading to a huge ac3/dts file and a small h264 file. eac3to's output is easy to parse though, much more so than ffmpeg which does seem to report more accurately some information. ffmpeg does round to 23.98 for 23.976, but I'm sure it's just a display limitation.
> 
> It seems that mp4box may not need to be told the timescale like mp4creator does. I got the latest build of mp4box, and had luck with it so far (used twice now, so not much test data yet). I'll try and put together an ffmpeg "interrogator", mkvextract, eac3to audio "manipulator" and mp4box muxer.


WOW, that would be one great program for tivo users. I really look forward to it. I think you are on the right track though, ffmpeg's info output is much more reliable. GOOD LUCK and have a merry Christmas!


----------



## hooper

I just tried converting a large mkv that has DTS audio and by the end of film, the audio was way out of sync. Like minutes. Started out pretty good though.


----------



## orangeboy

hooper said:


> I just tried converting a large mkv that has DTS audio and by the end of film, the audio was way out of sync. Like minutes. Started out pretty good though.


Could you copy/paste your *mkv.info.txt and *mp4.info.txt? They should only be a few lines each, so I don't think they would need to be posted as attachments.


----------



## hooper

orangeboy said:


> Could you copy/paste your *mkv.info.txt and *mp4.info.txt? They should only be a few lines each, so I don't think they would need to be posted as attachments.


Here you go:
mkv info
1: h264/AVC, English, 1280x544 23.975p 
2: DTS, 5.1 channels, 24 bits, 1509kbps, 48khz

mp4 info
Track	Type	Info
1	audio	ac-3, 8031.072 secs, 448 kbps, 48000 Hz
2	video	H264 [email protected], 8030.947 secs, 5477 kbps, 1280x544 @ 23.976002 fps


----------



## orangeboy

hooper said:


> Here you go:
> mkv info
> 1: h264/AVC, English, 1280x544 23.975p
> 2: DTS, 5.1 channels, 24 bits, 1509kbps, 48khz
> 
> mp4 info
> Track	Type	Info
> 1	audio	ac-3, 8031.072 secs, 448 kbps, 48000 Hz
> 2	video	H264 [email protected], 8030.947 secs, 5477 kbps, 1280x544 @ 23.976002 fps


Everything looks in order. I'm working on a new version that uses mp4box instead of mp4creator. Hopefully that will resolve the synchronization problems some are having.


----------



## jcthorne

bump...


----------



## orangeboy

jcthorne said:


> bump...


I didn't forget about this - 
I've decided to use a command line version of mediainfo to assess the input files. This was after working on using ffmpeg for the assessment. I found that ffmpeg would at times omit/include a field relating to a video's PAR & DAR, which in turn makes parsing the output for information more difficult (should I expect 6 variables or 7?!). mediainfo appears to be far superior being a single purpose application. I really wanted to get away from eac3to for file assessment, which I found to occasionally transpose the audio and video track IDs.

If you want to modify the existing batch program to use mp4box, you can add these lines:


Code:


			GOTO MP4Box
			:MP4Box
			%mp4boxPath% -add %AudioTrackName% -add %VideoTrackName% -fps %vfps% %OutputFullName% >>CON 2>&1

to the Main_Program section:


Code:


	IF EXIST %VideoTrackName% (
		IF EXIST %AudioTrackName% (
			ECHO.
			ECHO Extracted audio and video tracks found.
			ECHO Combining to create MP4 file...
			ECHO.
			GOTO MP4Box
			%mp4creatorPath% -create=%VideoTrackName% -rate=%vfps% -timescale=%vtimescale% -optimize -use64bits %OutputFullName% >>CON 2>&1
			%mp4creatorPath% -create=%AudioTrackName% -optimize %OutputFullName% >>CON 2>&1
			:MP4Box
			%mp4boxPath% -add %AudioTrackName% -add %VideoTrackName% -fps %vfps% %OutputFullName% >>CON 2>&1
		)
	)

And add this line:


Code:


SET mp4boxPath="C:\path\mp4box.exe"

to Required_Settings in the Set_User_Options section:


Code:


:Set_User_Options
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This subroutine sets user related variables.                              ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:Required_Settings
SET aLang=English
SET sLang=English
SET eac3toPath="C:\path\eac3to.exe"
SET mkvextractPath="C:\path\mkvextract.exe"
SET mp4creatorPath="C:\path\mp4creator.exe"
SET mp4boxPath="C:\path\mp4box.exe"
SET SubtitleYN=Y

Since I've not had success with mp4box (even with the new version), it's up to you to leave the fps= option in the command line or not...


----------



## ajayabb

bkdtv said:


> This is no longer the case, as far as I can tell.
> 
> TiVo Desktop Plus 2.8 natively transfers MP4 (H.264) files with AC3 audio.
> 
> I've been using Yamb 2.1b2 to save MKV files with AAC and DD5.1 audio as MP4 files. [This won't work for MKV files with DTS or >448Kbps DD5.1.] To do that, you click the Creation -> Click to Create a MP4 file... menu, and select the MKV file. It's simple and fast.
> 
> _Notes for those installing Yamb: Choose custom setup in the Yamb installer and check mkvextract. If you get an error about a missing regex.dll, you can download that here and place it in the mkvextract subfolder in the Yamb installation directory. If using Windows 7, sure to install the Yamb program to a folder where you have permissions to write, such as a subfolder in your Users folder (ex: My Documents or Desktop). _


I ran an MKV file with h.264 codec though Yamb, and it produced an MP4 video file with no sound and 2 separate AC3 audio files with no video. Did I do something wrong?


----------



## ajayabb

bkdtv said:


> This is no longer the case, as far as I can tell.
> 
> TiVo Desktop Plus 2.8 natively transfers MP4 (H.264) files with AC3 audio.
> 
> I've been using Yamb 2.1b2 to save MKV files with AAC and DD5.1 audio as MP4 files. [This won't work for MKV files with DTS or >448Kbps DD5.1.] To do that, you click the Creation -> Click to Create a MP4 file... menu, and select the MKV file. It's simple and fast.
> 
> _Notes for those installing Yamb: Choose custom setup in the Yamb installer and check mkvextract. If you get an error about a missing regex.dll, you can download that here and place it in the mkvextract subfolder in the Yamb installation directory. If using Windows 7, sure to install the Yamb program to a folder where you have permissions to write, such as a subfolder in your Users folder (ex: My Documents or Desktop). _


I ran an MKV file with h.264 codec though Yamb, and it extracted an MP4 video file with no sound and 2 separate AC3 audio files with no video. Did I do something wrong?


----------



## jcthorne

orangeboy said:


> I didn't forget about this -
> I've decided to use a command line version of mediainfo to assess the input files. This was after working on using ffmpeg for the assessment. I found that ffmpeg would at times omit/include a field relating to a video's PAR & DAR, which in turn makes parsing the output for information more difficult (should I expect 6 variables or 7?!). mediainfo appears to be far superior being a single purpose application. I really wanted to get away from eac3to for file assessment, which I found to occasionally transpose the audio and video track IDs.
> 
> If you want to modify the existing batch program to use mp4box, you can add these lines:
> 
> 
> Code:
> 
> 
> GOTO MP4Box
> :MP4Box
> %mp4boxPath% -add %AudioTrackName% -add %VideoTrackName% -fps %vfps% %OutputFullName% >>CON 2>&1
> 
> to the Main_Program section:
> 
> 
> Code:
> 
> 
> IF EXIST %VideoTrackName% (
> IF EXIST %AudioTrackName% (
> ECHO.
> ECHO Extracted audio and video tracks found.
> ECHO Combining to create MP4 file...
> ECHO.
> GOTO MP4Box
> %mp4creatorPath% -create=%VideoTrackName% -rate=%vfps% -timescale=%vtimescale% -optimize -use64bits %OutputFullName% >>CON 2>&1
> %mp4creatorPath% -create=%AudioTrackName% -optimize %OutputFullName% >>CON 2>&1
> :MP4Box
> %mp4boxPath% -add %AudioTrackName% -add %VideoTrackName% -fps %vfps% %OutputFullName% >>CON 2>&1
> )
> )
> 
> And add this line:
> 
> 
> Code:
> 
> 
> SET mp4boxPath="C:\path\mp4box.exe"
> 
> to Required_Settings in the Set_User_Options section:
> 
> 
> Code:
> 
> 
> :Set_User_Options
> :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
> :: This subroutine sets user related variables.                              ::
> :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
> :Required_Settings
> SET aLang=English
> SET sLang=English
> SET eac3toPath="C:\path\eac3to.exe"
> SET mkvextractPath="C:\path\mkvextract.exe"
> SET mp4creatorPath="C:\path\mp4creator.exe"
> SET mp4boxPath="C:\path\mp4box.exe"
> SET SubtitleYN=Y
> 
> Since I've not had success with mp4box (even with the new version), it's up to you to leave the fps= option in the command line or not...


Well, played with it both ways. Just like mp4creator it works sometimes and not others. I am at wits end with this. MeGUI does not always work either. I can start with an MKV that plays fine and the resulting mp4 is progressivly out of sync, and other files it works fine. There is something odd with the fps reporting by eac3to, mediainfo and even in mediaplayerclassic as they can all three give a different result for the same file! Is there a definitive way to tell the actual frame rate of a file that is playing? I'll go ask in the MeGUI developers forum but dont expect much help. Don't know what other tools to try...


----------



## orangeboy

jcthorne said:


> Well, played with it both ways. Just like mp4creator it works sometimes and not others. I am at wits end with this. MeGUI does not always work either. I can start with an MKV that plays fine and the resulting mp4 is progressivly out of sync, and other files it works fine. There is something odd with the fps reporting by eac3to, mediainfo and even in mediaplayerclassic as they can all three give a different result for the same file! Is there a definitive way to tell the actual frame rate of a file that is playing? I'll go ask in the MeGUI developers forum but dont expect much help. Don't know what other tools to try...


It sounds like you have a good file to test with. I keep thinking about these eac3to switches:


Code:


-slowdown          convert 25.000 and 24.000 content to 23.976 fps
-speedup           convert 23.976 and 24.000 content to 25.000 fps
-23.976/...        define source fps to be "23.976", "24.000", "25.000", ...
-changeTo24.000    change source fps to "23.976", "24.000", "25.000", ...

Would you consider changing this in the Main_Program routine:


Code:


			SET eac3to_parms=-libav !eac3to_parms!

to one of these and testing?


Code:


			SET eac3to_parms=-libav -slowdown !eac3to_parms!
			SET eac3to_parms=-libav -changeTo23.976 !eac3to_parms!
			SET eac3to_parms=-libav -changeTo&#37;vfps% !eac3to_parms!

I actually like the last one the best, given the potential for different framerate. It would be nice to just not specify ANYTHING and let it use what it finds, but I had audio drift when I did that in early testing.


----------



## Spenner

For a couple of h264 files I'm converting to MP4, the audio in the MP4 repeats roughly halfway through - has anyone seen that happen before?

For example, about 1:20 into a 2:20 film, the audio suddenly starts from the beginning again! And it plays that way through to the end.

It seems to be from the muxing - I can play the raw extracted ac3 file and it's fine at those points. I've had it happen on two different movies so far, and wound up having to push them letting pyTivo transcode to MPEG2, but I'd rather have the higher quality H264 if there was a known fix.

Thanks.


----------



## jcthorne

orangeboy said:


> It sounds like you have a good file to test with. I keep thinking about these eac3to switches:
> 
> 
> Code:
> 
> 
> -slowdown          convert 25.000 and 24.000 content to 23.976 fps
> -speedup           convert 23.976 and 24.000 content to 25.000 fps
> -23.976/...        define source fps to be "23.976", "24.000", "25.000", ...
> -changeTo24.000    change source fps to "23.976", "24.000", "25.000", ...
> 
> Would you consider changing this in the Main_Program routine:
> 
> 
> Code:
> 
> 
> SET eac3to_parms=-libav !eac3to_parms!
> 
> to one of these and testing?
> 
> 
> Code:
> 
> 
> SET eac3to_parms=-libav -slowdown !eac3to_parms!
> SET eac3to_parms=-libav -changeTo23.976 !eac3to_parms!
> SET eac3to_parms=-libav -changeTo&#37;vfps% !eac3to_parms!
> 
> I actually like the last one the best, given the potential for different framerate. It would be nice to just not specify ANYTHING and let it use what it finds, but I had audio drift when I did that in early testing.


OK, tried those ideas, failed, and kept going....

I think I found a combo that works on many files and I'll explain.

First I change the bat file to extract with eac3to instead of mkvextract. Both audio and video, conversion of audio on the fly is necessary is possible this way too. What prompted me to try this was a discussion over at doom9 about eac3to adding sync logic a couple revisions back. Thought it worth a try. Here is the command line I used today in your bat file:

%eac3toPath% %SourceFullName% %VideoTrackName% %AudioTrackName% !eac3to_parms! >>CON 2>&1

in my case eac3to_parms only had -448 in it, may be all that is necessary as I found when the bit rate was -448 or lower, no recoding was done and the outputfile name tells it to extract as ac3.

Remux was done with mp4box with the following command:

%mp4boxPath% -add %AudioTrackName% -add %VideoTrackName% %OutputFullName% -isma >>CON 2>&1

note the lack of -fps conversion. Yes, the output file remains the same as the VIDEO track of the input file with the ac3 synced to it. Also the -isma command forces an ISMA compliant streamable mp4 file that tivo likes and streambaby can stream without conversion.

All this is down and dirty, the full batch file I have now is pretty hacked up but found what I needed to know.

I did discover something along the way. I have a few mkv files that CANNOT be converted to mp4 without full reencodeing. It seems mkv will allow a video track with one non compliant frame rate in a container of a different frame rate and the audio to play as encoded.....what a mess. To make this a compliant and streamable mp4 would require the video re-encoded to a standard frame rate, the audio speed adjusted to match and then remuxed. Good luck on that one. I'll just skip those poorly built mkvs.....

Orangeboy I sure hope I provided enought food for thought to get your excellent batch file codeing abilities to smooth the edges and add the rest of your features. I spent most of the day fooling with this. Did not really need to work right?


----------



## txporter

Not sure if you read the Streambaby thread or not, but there is a member there (Yog) that has a similar method for repackaging mkv into mp4. (Link)

He uses ffmpeg to extract the audio which I just "discovered" today. Can ffmpeg not demux h.264 streams from mkv files?
(something like ffmpeg -i video.mkv -vcodec copy video.264 -acodec copy video.ac3)

Mostly a curiosity question since I don't need to do this myself. I just see everyone talking about using mkvextract for this...and it seems like it must have been necessary at some point to write an app for doing it (hence the mkvextract).


----------



## jcthorne

Using ffmpeg to extract ac3 and h264 tracks could be yet another option. ffmpeg's history with audio sync on other types of files is not stellar though. But it is in active development. Still it cannot produce a streamable mp4 file, even in multiple passes. For now, using eac3to for audio & video extraction, onthe fly audio conversion and mp4box for muxing. Partly because those are the same tools MeGUI uses and it mostly works there but not at all automated.

With the batch file orangeboy created, its drag and drop simple. Drag an mkv to the bat file and you get a matching mp4 ready for tivo. The subtitile thing is an interesting thing to work at though. I'll continue to follow both threads.


----------



## txporter

jcthorne said:


> Using ffmpeg to extract ac3 and h264 tracks could be yet another option. ffmpeg's history with audio sync on other types of files is not stellar though. But it is in active development. Still it cannot produce a streamable mp4 file, even in multiple passes. For now, using eac3to for audio & video extraction, onthe fly audio conversion and mp4box for muxing. Partly because those are the same tools MeGUI uses and it mostly works there but not at all automated.
> 
> With the batch file orangeboy created, its drag and drop simple. Drag an mkv to the bat file and you get a matching mp4 ready for tivo. The subtitile thing is an interesting thing to work at though. I'll continue to follow both threads.


I just started toying with ffmpeg for audio extraction last night. I have been searching for a way to extract the audio stream without adding the stream information to the audio file (the way DGIndex does and from what little I have played with it, eac3to as well). At any rate, the audio sync seems fine, but I am muxing MPEG2 with mplex so maybe that is why. Do you know if it is possible to extract audio to a given filename without all the stream information using eac3to?


----------



## orangeboy

jcthorne said:


> OK, tried those ideas, failed, and kept going....
> 
> I think I found a combo that works on many files and I'll explain.
> 
> ....
> 
> Orangeboy I sure hope I provided enought food for thought to get your excellent batch file codeing abilities to smooth the edges and add the rest of your features. I spent most of the day fooling with this. Did not really need to work right?


Nice finds! I rather like the idea of eac3to doing the extraction. The problems I've had with eac3to transposing/misidentifying the audio and video tracks should be rendered moot if the same app is both identifying and extracting. I'll take a look to if it supports extraction of text/srt subtitle tracks. If it doesn't, I'll keep mkvextract around as an option only, based on subtitle preference.

I'll start applying the changes!


----------



## txporter

orangeboy said:


> Nice finds! I rather like the idea of eac3to doing the extraction. The problems I've had with eac3to transposing/misidentifying the audio and video tracks should be rendered moot if the same app is both identifying and extracting. I'll take a look to if it supports extraction of text/srt subtitle tracks. If it doesn't, I'll keep mkvextract around as an option only, based on subtitle preference.
> 
> I'll start applying the changes!


Looks like if you use -demux with eac3to it will demux all video, audio and subtitles. I tried this with a short MPEG2 clip and it seemed to do audio/video fine, but the subtitles were not complete.


----------



## jcthorne

txporter said:


> I just started toying with ffmpeg for audio extraction last night. I have been searching for a way to extract the audio stream without adding the stream information to the audio file (the way DGIndex does and from what little I have played with it, eac3to as well). At any rate, the audio sync seems fine, but I am muxing MPEG2 with mplex so maybe that is why. Do you know if it is possible to extract audio to a given filename without all the stream information using eac3to?


eac3to has no trouble generating an ac3 file from an mkv if that is what you are asking. Does not matter if the mkv contains aac, dts or mp3, will convert on the fly.


----------



## txporter

jcthorne said:


> eac3to has no trouble generating an ac3 file from an mkv if that is what you are asking. Does not matter if the mkv contains aac, dts or mp3, will convert on the fly.


Mostly, I want to specify a name for the file. When I just use -demux, I get an audio file with this naming structure (video - 2 - AC3, 5.1 channels, 448kbps, 48khz.ac3). I want it to output just 'video.ac3'. Mostly because I am not good with scripting and it is much easier for me to handle in my batch files .

update: Figured it out....pretty easy. Just eac3to video.mpg video.ac3. Easy as that. Might use this instead of ffmpeg for extraction. I tend to avoid ffmpeg if possible. Not entirely sure why though since I haven't really had any personal problems with it. Must be from too much forum browsing.


----------



## jcthorne

eac3to inputfile.mkv outputfile.ac3 -448

this will get you an output file called outputfile.ac3 conatining an ac3 track limited to 448 kbps.


----------



## orangeboy

jcthorne said:


> I did discover something along the way. I have a few mkv files that CANNOT be converted to mp4 without full reencodeing. It seems mkv will allow a video track with one non compliant frame rate in a container of a different frame rate and the audio to play as encoded.....what a mess. To make this a compliant and streamable mp4 would require the video re-encoded to a standard frame rate, the audio speed adjusted to match and then remuxed. Good luck on that one. I'll just skip those poorly built mkvs.....


What happens with those oddball mkvs? Does one of the programs crash?


----------



## tgrim1

I'm having trouble during the initial setup of the batch file and wonder if someone could help. When I enter the path to eac3to.exe and hit "enter" the cmd window closes, to fast to read the line it outputs to the screen. can I enter this manually in the batch file?
I created a folder for these programs directly under c:\ and put them all there as well as the batch file. 
I'm running W7-64bit if that helps.


----------



## orangeboy

tgrim1 said:


> I'm having trouble during the initial setup of the batch file and wonder if someone could help. When I enter the path to eac3to.exe and hit "enter" the cmd window closes, to fast to read the line it outputs to the screen. can I enter this manually in the batch file?
> I created a folder for these programs directly under c:\ and put them all there as well as the batch file.
> I'm running W7-64bit if that helps.


You should be able to see the error if your run the batch from an existing command window. At the end of processing, I exit the batch using "EXIT /B", which will end the program, but leave an existing command window open. I'm not familiar with Windows 7, so I can't tell you how to open a command prompt. Once you get one open though, call the batch file using the full path to a video as an argument:

"C:\path\to\batch\mkv2mp4.bat" "C:\path\to\video\video.mkv"

I'm sure the error will be something like ") was unexpected". I'm about done with another revision, and if there's something I can fix now, I'd definitely want to know about it!


----------



## jcthorne

orangeboy said:


> What happens with those oddball mkvs? Does one of the programs crash?


No, just results in an mp4 file with very bad and progressively worse audio sync. Eac3to does post a warning about it but goes on and trys.

I did have one file that the batch file consistantly bombed on. Took a while to figure out but it contained an & in the file name. Somewhere in the code it was not playing nice. Got rid of the ampersand and things went fine.


----------



## tgrim1

orangeboy said:


> You should be able to see the error if your run the batch from an existing command window. At the end of processing, I exit the batch using "EXIT /B", which will end the program, but leave an existing command window open. I'm not familiar with Windows 7, so I can't tell you how to open a command prompt. Once you get one open though, call the batch file using the full path to a video as an argument:
> 
> "C:\path\to\batch\mkv2mp4.bat" "C:\path\to\video\video.mkv"
> 
> I'm sure the error will be something like ") was unexpected". I'm about done with another revision, and if there's something I can fix now, I'd definitely want to know about it!


Thanks, I'll try that tonight and see what the problem is.


----------



## tgrim1

orangeboy said:


> You should be able to see the error if your run the batch from an existing command window. At the end of processing, I exit the batch using "EXIT /B", which will end the program, but leave an existing command window open. I'm not familiar with Windows 7, so I can't tell you how to open a command prompt. Once you get one open though, call the batch file using the full path to a video as an argument:
> 
> "C:\path\to\batch\mkv2mp4.bat" "C:\path\to\video\video.mkv"
> 
> I'm sure the error will be something like ") was unexpected". I'm about done with another revision, and if there's something I can fix now, I'd definitely want to know about it!


This is what I got after entering full path to eac3to.exe


Code:


* eac3to.exe path
Enter the full path (including file name and extension) to eac3to.exe:
Full path: C:\Users\ECD\eac3to\eac3to.exe
\MKVtoolnix\mkvextract.exe was unexpected at this time.
20:56:42.92>

UPDATE:
Well I copied and pasted the "Set_User_Options" section that someone had posted and entered my appropriate path data, now I'm good to go. I've done several movies and they convert and play fine using streambaby. This batch file is awesome! thanks!


----------



## orangeboy

tgrim1 said:


> This is what I got after entering full path to eac3to.exe
> 
> 
> Code:
> 
> 
> * eac3to.exe path
> Enter the full path (including file name and extension) to eac3to.exe:
> Full path: C:\Users\ECD\eac3to\eac3to.exe
> \MKVtoolnix\mkvextract.exe was unexpected at this time.
> 20:56:42.92>


That's peculiar. It looks to me like the path to eac3to.exe is accepted, then moving onto mkvextract.exe, it doesn't like what it's finding. No guarantees, but you could try this new one? (see attachment)

For those following along at home, I altered this line in the Find_Program subroutine:


Code:


	SET ProgramFound=%~$PATH:1

 is now


Code:


	SET ProgramFound=%~dp$PATH:1

If that doesn't work, then the next thing to do is alter the very first line of the batch, adding :: (colon colon) in front of the @ECHO OFF. This will show the steps (for the most part) as the batch runs. It's best for the time being to invoke it again in an existing command window.

(attachment removed - 
"SET ProgramFound=%~dp$PATH:1" makes things worse!)


----------



## orangeboy

OK, I've done some modifications to the batch file, adding mp4box support as a muxing option. I've also used jcthorne's trials with eac3to to eliminate a step or two. eac3to now does the extraction of all the preferred tracks (video, audio, and optional subtitle), and to on-the-fly normalize the audio track to TiVo specs if needed. I eliminated creation of the input and output "info" files. This is because I initially used eac3to to determine the input file's information, and mp4creator to determine the output file's info, and I just didn't feel mp4box's "-info" option produced equivalent or presentable comparative information. I also added support for files with up to 29 tracks. I found that the original batch file didn't report tracks greater than 10 correctly, which has the potential to miss a preferred language subtitle track. Most everything else is the same.

I wanted to post this version of the batch now because I kept finding myself distracted trying to incorporate a command line version of mediainfo for reporting, and feared I would never get it posted.

Let me know if you run into problems during setup or execution, and I'll do my best to get it fixed! Thanks again to jcthorne for the original batch and the streamlining efforts with eac3to. I just wish I could get mp4box to work (consistently) for me!

You can get mp4box from this site.


----------



## ascl

First off... thanks for the script! Self-modifying code at that... I like it! 
Secondly... sorry for the long post, my windows scripting skills are terrible, so I wanted to provide all the info.

Anyway, I noticed a small issue when calling mp4box the way its called. For reasons I don't understand, it would re-write the video track to a fps of 25 (rather than the source 23.96), which meant my video track was 2 mins shorter than the audio track (and obviously everything was out of sync!).

Medioinfo correctly finds the video fps, however, I get this in the console (info seems more complete than the log file?):



Code:


Gathering file information. Please wait...

Input file information:
-----------------------
1: h264/AVC, English, 720p (16:9)

2: AC3, English, 5.1 channels, 384kbps, 48khz, dialnorm: -27dB



Video and audio codecs are compatible.
Starting extraction process...

MKV, 1 video track, 1 audio track, 0:42:24, 24p /1.001
1: h264/AVC, English, 720p (16:9)
2: AC3, English, 5.1 channels, 384kbps, 48khz, dialnorm: -27dB
v01 The video track doesn't contain framerate information.
v01 Extracting video track number 1...
a02 Extracting audio track number 2...
v01 Writing new framerate "24fps /1.001" to bitstream.
a02 Removing AC3 dialog normalization...
v01 Creating file "test.h264"...
a02 Creating file "test.ac3"...
Video track 1 contains 60990 frames.
eac3to processing took 43 seconds.
Done.

Extracted audio and video tracks found.
Combining to create MP4 file...

AC3 import - sample rate 48000 - 6 channels
AVC-H264 import - frame size 1280 x 720 at 25.000 FPS
Importing AVC-H264: |====                | (21/100)

Note the different frame rates!

I made the following change and it resulted in sync'd audio:


Code:


--- mkv2tivomp4.v3 (2).txt	2010-02-19 09:03:33.252079200 +1100
+++ mkvtomp4.cmd	2010-02-19 09:41:55.333750800 +1100
@@ -262,7 +262,7 @@
 			%mp4creatorPath% -create=%AudioTrackName% -optimize %OutputFullName% >>CON 2>&1
 			GOTO Cleanup
 			:mp4box
-			%mp4boxPath% -add %AudioTrackName% -add %VideoTrackName% %OutputFullName% -isma >>CON 2>&1
+			%mp4boxPath% -add %AudioTrackName% -add %VideoTrackName%:fps=%vfps% %OutputFullName% -isma >>CON 2>&1
 		)
 	)
 )

If I'd just used mp4creator this probably wouldn't have been an issue...


----------



## orangeboy

ascl said:


> First off... thanks for the script! Self-modifying code at that... I like it!
> Secondly... sorry for the long post, my windows scripting skills are terrible, so I wanted to provide all the info.
> 
> Anyway, I noticed a small issue when calling mp4box the way its called. For reasons I don't understand, it would re-write the video track to a fps of 25 (rather than the source 23.96), which meant my video track was 2 mins shorter than the audio track (and obviously everything was out of sync!).
> 
> Medioinfo correctly finds the video fps, however, I get this in the console (info seems more complete than the log file?):
> 
> 
> 
> Code:
> 
> 
> Gathering file information. Please wait...
> 
> Input file information:
> -----------------------
> 1: h264/AVC, English, 720p (16:9)
> 
> 2: AC3, English, 5.1 channels, 384kbps, 48khz, dialnorm: -27dB
> 
> 
> 
> Video and audio codecs are compatible.
> Starting extraction process...
> 
> MKV, 1 video track, 1 audio track, 0:42:24, 24p /1.001
> 1: h264/AVC, English, 720p (16:9)
> 2: AC3, English, 5.1 channels, 384kbps, 48khz, dialnorm: -27dB
> v01 The video track doesn't contain framerate information.
> v01 Extracting video track number 1...
> a02 Extracting audio track number 2...
> v01 Writing new framerate "24fps /1.001" to bitstream.
> a02 Removing AC3 dialog normalization...
> v01 Creating file "test.h264"...
> a02 Creating file "test.ac3"...
> Video track 1 contains 60990 frames.
> eac3to processing took 43 seconds.
> Done.
> 
> Extracted audio and video tracks found.
> Combining to create MP4 file...
> 
> AC3 import - sample rate 48000 - 6 channels
> AVC-H264 import - frame size 1280 x 720 at 25.000 FPS
> Importing AVC-H264: |====                | (21/100)
> 
> Note the different frame rates!
> 
> I made the following change and it resulted in sync'd audio:
> 
> 
> Code:
> 
> 
> --- mkv2tivomp4.v3 (2).txt	2010-02-19 09:03:33.252079200 +1100
> +++ mkvtomp4.cmd	2010-02-19 09:41:55.333750800 +1100
> @@ -262,7 +262,7 @@
> &#37;mp4creatorPath% -create=%AudioTrackName% -optimize %OutputFullName% >>CON 2>&1
> GOTO Cleanup
> :mp4box
> -			%mp4boxPath% -add %AudioTrackName% -add %VideoTrackName% %OutputFullName% -isma >>CON 2>&1
> +			%mp4boxPath% -add %AudioTrackName% -add %VideoTrackName%:fps=%vfps% %OutputFullName% -isma >>CON 2>&1
> )
> )
> )
> 
> If I'd just used mp4creator this probably wouldn't have been an issue...


Dunno how I missed this post! I added the "%VideoTrackName%:fps=%vfps%" to this latest script found here.


----------



## superflysocal

orangeboy,
can you explain to a newbie how you set up your system in a way that allows me to right click on an mkv file, go to "Send To" and have this script be an option?


----------



## orangeboy

superflysocal said:


> orangeboy,
> can you explain to a newbie how you set up your system in a way that allows me to right click on an mkv file, go to "Send To" and have this script be an option?


Sure! I'm on Windows XP, so the path to my SendTo folder is here:

C:\Documents and Settings\orangeboy\SendTo

Navigate to that folder, and then Right-click > New > Shortcut.
A dialog will ask what item you want a shortcut to, and you can either type in where the script is, or use the browse button to find it. I personally keep all my batch files in C:\path (which is also concatenated to my %path% environment variable), so it's easy for me to find. 
The New Shortcut dialog will then allow you to come up with a "friendly" name if you want, or you can let it default to just the filename. After that, you're done!

Now you should be able to right-click a .mkv file, and SendTo the new shortcut you created. Makes it nice when you have a bunch of files in an Explorer window, such as a Search results list of .mkv files. Select all of them and do the SendTo thing, and they'll cycle through one at a time, unattended if you want.

Let me know if you run into problems!

Edit: you may be able to use: C:\Documents and Settings\Default User\SendTo so all users of the computer have the option. I keep my stuff to myself though. I'm selfish that way.


----------



## superflysocal

will this batch file (or do you know of another) convert a mp4 file with 6 ch aac to mp4+2 ch aac?


----------



## cbomba

I get the following error when using mp4creator. I haven't tried MP4Box yet. The file still gets created and I tried watching a little bit on the Tivo and it worked. I can't seem to get it to play on the computer using VLC/Quicktime/ZPlayer.



Code:


Gathering file information. Please wait...

Input file information:
-----------------------
1: h264/AVC, English, 1280x696 24p /1.001

2: DTS, 5.1 channels, 24 bits, 1509kbps, 48khz



Video and audio codecs are compatible.
Starting extraction process...

MKV, 1 video track, 1 audio track, 2:02:32, 24p /1.001
1: h264/AVC, English, 1280x696 24p /1.001
2: DTS, 5.1 channels, 24 bits, 1509kbps, 48khz
v01 Extracting video track number 1...
a02 Extracting audio track number 2...
a02 Decoding with libav/ffmpeg...
a02 Remapping channels...
a02 Encoding AC3 <448kbps> with libAften...
v01 Creating file "alli-doctor-720p.h264"...
a02 Creating file "alli-doctor-720p.ac3"...
Video track 1 contains 176280 frames.
eac3to processing took 14 minutes, 7 seconds.
Done.

Extracted audio and video tracks found.
Combining to create MP4 file...

Error decoding sei message


----------



## orangeboy

cbomba said:


> I get the following error when using mp4creator. I haven't tried MP4Box yet. The file still gets created and I tried watching a little bit on the Tivo and it worked. I can't seem to get it to play on the computer using VLC/Quicktime/ZPlayer.
> 
> 
> 
> Code:
> 
> 
> Gathering file information. Please wait...
> 
> <snip stuff>
> 
> Extracted audio and video tracks found.
> Combining to create MP4 file...
> 
> Error decoding sei message


Yep, run into the same thing: http://tivocommunity.com/tivo-vb/showthread.php?p=7641579#post7641579

And I have no idea what an sei message is...


----------



## jehuva

Having a little trouble hoping someone can point me in the right direction... my MKV files run through the batch no problem and create the desire .mp4

However, when trying to play the new files locally, i get no audio (video is perfect)

When I try to transfer the file via pyTivo it still tries to transcode saying "seems stream 0 codec frame rate differs from container frame rate..."

Would love to know what I am doing wrong!

thanks


----------



## Rdian06

jehuva said:


> Having a little trouble hoping someone can point me in the right direction... my MKV files run through the batch no problem and create the desire .mp4
> 
> However, when trying to play the new files locally, i get no audio (video is perfect)
> 
> When I try to transfer the file via pyTivo it still tries to transcode saying "seems stream 0 codec frame rate differs from container frame rate..."
> 
> Would love to know what I am doing wrong!
> 
> thanks


Are you Pulling the video by starting the transfer from the Now Playing list or Pushing the video by using the pyTivo web interface?

MP4 will ONLY transfer without transcoding if you do a Push transfer from the pyTivo web interface.


----------



## jehuva

Ah I am pulling.. will figure out how to push and try again... thanks for the info


----------



## jehuva

Works great now that I am doing it right 

Now to make a shell script equivalent of this wonderful batch...


----------



## orangeboy

jehuva said:


> Works great now that I am doing it right
> 
> Now to make a shell script equivalent of this wonderful batch...


Hopefully it's documented enough to get the general gist of what's happening. PM me if there are any places that is questionable!


----------



## orangeboy

I just found an occurrence where an .mkv file had the audio description as "AC3 Surround", which then prompted the .bat file to report that a "Valid audio stream not found". This of course is incorrect since AC3 is indeed valid. I changed the audio search routines which uses the Windows command "FINDSTR" to include a regular expression search:



Code:


FOR /F "tokens=1,3-5 delims=:,/BDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz " %%A IN ('FINDSTR /R /C:"%1 %2.*, %3" %SourceInfoName%') DO (
...

If you already have your batch file preferences set, you could update both lines 797 (for AC3) and 812 (for DTS) to include this change.
The pertinent code change is this:


Code:


('FINDSTR /R /C:"%1 %2.*, %3" %SourceInfoName%')

With the release of the Premiere, I may need to update this to include the more aggressive bitrates allowed!


----------



## darynsd

I'm trying to push a file to my S3 TiVo and can't seem to get the video parameters correct. After running it through the batch file, it has the following parameters:



Code:


Format                           : MPEG-4
Format profile                   : Base Media
Codec ID                         : isom
File size                        : 1.46 GiB
Duration                         : 1h 7mn
Overall bit rate                 : 3 105 Kbps

Video
ID                               : 201
Format                           : AVC
Format/Info                      : Advanced Video Codec
Format profile                   : [email protected]
Format settings, CABAC           : Yes
Format settings, ReFrames        : 4 frames
Codec ID                         : avc1
Codec ID/Info                    : Advanced Video Coding
Duration                         : 1h 7mn
Bit rate mode                    : Variable
Bit rate                         : 2 735 Kbps
Maximum bit rate                 : 7 231 Kbps
Width                            : 1 280 pixels
Height                           : 720 pixels
Display aspect ratio             : 16:9
Frame rate mode                  : Constant
Frame rate                       : 23.976 fps
Original frame rate              : 25.000 fps
Resolution                       : 8 bits
Colorimetry                      : 4:2:0
Scan type                        : Progressive
Bits/(Pixel*Frame)               : 0.124
Stream size                      : 1.28 GiB (88%)

Audio
ID                               : 101
Format                           : AC-3
Format/Info                      : Audio Coding 3
Codec ID                         : ac-3
Duration                         : 1h 4mn
Bit rate mode                    : Constant
Bit rate                         : 384 Kbps
Channel(s)                       : 6 channels
Channel positions                : Front: L C R, Side: L R, LFE
Sampling rate                    : 48.0 KHz
Resolution                       : 16 bits
Stream size                      : 177 MiB (12%)

It would appear to be compatible with my S3, right? Any suggestions as to why there's no picture? Thanks!


----------



## jimmy8765

I ripped my blu ray disc to MPEG-2 HD VIDEO(*.mpg)

settings: video codec:mpeg2, 1920*1080, 8000kbps, 25fps, audio codec:mp2, stereo

The exported videos can be pushed to Series 3 TiVos natively.

PS:For h264 playback, the Tivo decoder has a bug with the aspect ratio used to display any 1280 based video that is not 1280x720 exactly. So for example 1280x720 displays fine but 1280x544 does not. 1920 based video does not suffer from the same kind of problem.

you can try this tool:http://www.tivocommunity.com/tivo-vb/showthread.php?p=7878474


----------



## darynsd

Thanks, but I was trying to avoid transcoding the file. It's originally H.264 video and transfers much faster due to the smaller file size. I noticed that Orangeboy's script changes the frame rate from 25 to 23.976 fps and the duration for the video and audio are now slightly off. Another thread indicated that H.264 material with 23.976 fps rates didn't work for the TiVo HD/S3, only the Premier?


----------



## orangeboy

darynsd said:


> Thanks, but I was trying to avoid transcoding the file. It's originally H.264 video and transfers much faster due to the smaller file size. I noticed that Orangeboy's script changes the frame rate from 25 to 23.976 fps and the duration for the video and audio are now slightly off. Another thread indicated that H.264 material with 23.976 fps rates didn't work for the TiVo HD/S3, only the Premier?


I only built in NTSC frame rates, and not PAL:

"25p is a video format which runs twenty-five progressive frames per second. This framerate is derived from the PAL television standard of 50i (or 50 interlaced fields per second). While 25p captures only half the motion that normal 50i PAL registers, it yields a higher vertical resolution on moving subjects. It is also better suited to progressive-scan output (e.g., on LCD displays, computer monitors and projectors) because the interlacing is absent. Like 24p, 25p is often used to achieve "cine"-look."

Do you have the MediaInfo for before (mkv) and after (mp4)?


----------



## darynsd

Here's the MediaInfo for the original MKV file:



Code:


General
Complete name                    : F:\Doctor.Who.2005.5x01.The.Eleventh.Hour.720p.HDTV.x264-FoV.mkv
Format                           : Matroska
File size                        : 1.46 GiB
Duration                         : 1h 4mn
Overall bit rate                 : 3 237 Kbps
Encoded date                     : UTC 2010-04-03 19:02:00
Writing application              : mkvmerge v2.9.8 ('C'est le bon') built on Aug 13 2009 16:16:13
Writing library                  : libebml v0.7.7 + libmatroska v0.8.1

Video
ID                               : 1
Format                           : AVC
Format/Info                      : Advanced Video Codec
Format profile                   : [email protected]
Format settings, CABAC           : Yes
Format settings, ReFrames        : 4 frames
Muxing mode                      : Container [email protected]
Codec ID                         : V_MPEG4/ISO/AVC
Duration                         : 1h 4mn
Bit rate                         : 2 789 Kbps
Nominal bit rate                 : 2 849 Kbps
Width                            : 1 280 pixels
Height                           : 720 pixels
Display aspect ratio             : 16:9
Frame rate mode                  : Variable
Frame rate                       : 25.000 fps
Resolution                       : 8 bits
Colorimetry                      : 4:2:0
Scan type                        : Progressive
Bits/(Pixel*Frame)               : 0.121
Stream size                      : 1.26 GiB (86%)
Writing library                  : x264 core 84 r1416 fcf70c2
Encoding settings                : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=6 / psy=1 / psy_rd=1.0:0.0 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / sliced_threads=0 / nr=0 / decimate=1 / mbaff=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / wpredb=1 / wpredp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc=2pass / mbtree=0 / bitrate=2849 / ratetol=1.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / pb_ratio=1.30 / aq=1:1.00

Audio
ID                               : 2
Format                           : AC-3
Format/Info                      : Audio Coding 3
Codec ID                         : A_AC3
Duration                         : 1h 4mn
Bit rate mode                    : Constant
Bit rate                         : 384 Kbps
Channel(s)                       : 6 channels
Channel positions                : Front: L C R, Side: L R, LFE
Sampling rate                    : 48.0 KHz
Stream size                      : 177 MiB (12%)

I changed your script to set vfps=25.000 & set vtimescale=25000 in an effort to keep the audio and video in sync.

Here's the MediaInfo for the resulting mp4:



Code:


General
Complete name                    : F:\TiVo GoBack\Doctor.Who h264 25fps.mp4
Format                           : MPEG-4
Format profile                   : Base Media
Codec ID                         : isom
File size                        : 1.46 GiB
Duration                         : 1h 4mn
Overall bit rate                 : 3 238 Kbps
Encoded date                     : UTC 2010-04-11 14:08:53
Tagged date                      : UTC 2010-04-11 14:08:53

Video
ID                               : 201
Format                           : AVC
Format/Info                      : Advanced Video Codec
Format profile                   : [email protected]
Format settings, CABAC           : Yes
Format settings, ReFrames        : 4 frames
Codec ID                         : avc1
Codec ID/Info                    : Advanced Video Coding
Duration                         : 1h 4mn
Bit rate mode                    : Variable
Bit rate                         : 2 851 Kbps
Maximum bit rate                 : 7 704 Kbps
Width                            : 1 280 pixels
Height                           : 720 pixels
Display aspect ratio             : 16:9
Frame rate mode                  : Constant
Frame rate                       : 25.000 fps
Resolution                       : 8 bits
Colorimetry                      : 4:2:0
Scan type                        : Progressive
Bits/(Pixel*Frame)               : 0.124
Stream size                      : 1.28 GiB (88%)
Title                            : Imported with GPAC 0.4.6-DEV (build 1)
Encoded date                     : UTC 2010-04-11 14:08:54
Tagged date                      : UTC 2010-04-11 14:09:25

Audio
ID                               : 101
Format                           : AC-3
Format/Info                      : Audio Coding 3
Codec ID                         : ac-3
Duration                         : 1h 4mn
Bit rate mode                    : Constant
Bit rate                         : 384 Kbps
Channel(s)                       : 6 channels
Channel positions                : Front: L C R, Side: L R, LFE
Sampling rate                    : 48.0 KHz
Resolution                       : 16 bits
Stream size                      : 177 MiB (12%)
Title                            : Imported with GPAC 0.4.6-DEV (build 1)
Encoded date                     : UTC 2010-04-11 14:08:53
Tagged date                      : UTC 2010-04-11 14:09:25

It seems like it should work but the result was the same -audio, but no video playback. Any thoughts?


----------



## tootal2

Have you tried video redo tv V4 h.264? it a bata copy but you can download it.


----------



## tgrim1

tootal2 said:


> Have you tried video redo tv V4 h.264? it a bata copy but you can download it.


I dont think it can open mkv's yet, though I could be wrong.


----------



## orangeboy

darynsd said:


> Here's the MediaInfo for the original MKV file:
> 
> <snip>
> 
> I changed your script to set vfps=25.000 & set vtimescale=25000 in an effort to keep the audio and video in sync.
> 
> Here's the MediaInfo for the resulting mp4:
> 
> <snip>
> 
> It seems like it should work but the result was the same -audio, but no video playback. Any thoughts?


I found this episode and will see what it will do on my machine...


----------



## darynsd

tootal2 said:


> Have you tried video redo tv V4 h.264? it a bata copy but you can download it.


I believe tgrim1 is correct about VRD not being able to open MKV files. I have actually tried the beta version after first using tsmux to change the container from .mkv to .ts. VRD tv4/h.264 will open that and can export it back out as an mp4 without remuxing -but I still can't get any video playback on my S3.

I'm assuming there is some parameter in the h.264 file it doesn't like. The only files I've tried this on are from the BBC. When I push it with pyTivo, it first says "TRANSCODE=YES" (something about the vcodec being incompatible?) but next says "TRANSCODE=NO" and sends it. I'm not sure what makes it change its mind.


----------



## orangeboy

I'm able to get both audio and video when playing back on my Series4 (Premiere), but not my Series3 (model 648). And yes, the A/V is horribly out of sync. I never expected PAL framerates to come into play, and I'll work on an update to support those I guess!


----------



## tgrim1

orangeboy said:


> I'm able to get both audio and video when playing back on my Series4 (Premiere), but not my Series3 (model 648). And yes, the A/V is horribly out of sync. I never expected PAL framerates to come into play, and I'll work on an update to support those I guess!


Please do! That would be awesome for my UK shows!


----------



## orangeboy

tgrim1 said:


> Please do! That would be awesome for my UK shows!


I've got an updated version that I'm about to post that handles PAL framerates as well. I also incorporated a "settings check" that determines the existence of a <program name>.ini file that contains your language preferences, executable file paths, etc., so you don't have to re-run the initial "User Options" dialog if the file is found.

If you want to get a jump on things, copy and paste from here and below in your (existing) batch file:


Code:


:Set_User_Options
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This subroutine sets user related variables.                              ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

into a <your batch file name>.ini file, in the same directory that your batch file resides. Version 6 (and above) will find that .ini file and append it to the skeleton batch files I post here, saving you the step of re-setting those options...

Example: The batch file name that I use is mkv2mp4.bat. I now have an mkv2mp4.ini file in the same directory as the .bat file. I leave the version out of the name, so it stays as generic as possible and I don't have to go and update my shortcuts.


----------



## orangeboy

This version adds support for PAL framerates (based on Frame rate wiki) and allows for "importing" of user preferences (see the above post for details).

As always, let me know about bugs that you may uncover!


----------



## tgrim1

orangeboy said:


> This version adds support for PAL framerates (based on Frame rate wiki) and allows for "importing" of user preferences (see the above post for details).
> 
> As always, let me know about bugs that you may uncover!


It worked on my drwho files :up:


----------



## Phantom Gremlin

orangeboy said:


> As always, let me know about bugs that you may uncover!





tgrim1 said:


> It worked on my drwho files :up:


I haven't used this software, perhaps never will. But since you (orangeboy) made a remark in the TiVo Desktop thread, I wanted to comment.

Your support here is fantastic. A bug reported one day, a fix the next. Contrast with TiVo Desktop, which people are paying for (at least indirectly). Windows 7 is out for 6 months and people are still waiting for corresponding changes to TiVo Desktop.

Yes a batch file is hardly as complex as TiVo Desktop, but the ideal of being responsive to bugs and/or enhancement requests is the same.


----------



## darynsd

Phantom Gremlin said:


> Your support here is fantastic.


I'll second that! Very responsive and I really appreciate the help!



tgrim1 said:


> It worked on my drwho files :up:


Unfortunately for me, I have the same result as before, no video.

orangeboy- Did you get this file to work on your S3? 
tgrim1- Are you using an S3, HD or Premier?


----------



## djwilso

orangeboy said:


> This version adds support for PAL framerates (based on Frame rate wiki) and allows for "importing" of user preferences (see the above post for details).
> 
> As always, let me know about bugs that you may uncover!


Wow, that is one of the longest most amazing batch files I have ever seen.

Good job!


----------



## orangeboy

darynsd said:


> ...
> orangeboy- Did you get this file to work on your S3?
> ...


Unfortunately, no. I think that particular file's problem may be the level or profile of h264. I've not actually come across mkv files having <> [email protected] until that Dr. Who episode. I think both mp4creator and mp4box "supports" altering the level and/or profile:



Code:


mp4box option:
 ":profile"           forces the profile for the H.264 content
 ":level"             forces the level for the H.264 content

mp4creator option(?):
 -mpeg4-video-profile=<level> Mpeg4 video profile override

but I don't think it actually changes anything except a few bits at the beginning a the file so it _reports_ the level or profile specified...


----------



## orangeboy

djwilso said:


> Wow, that is one of the longest most amazing batch files I have ever seen.
> 
> Good job!


Long? Yes. Amazing? Debatable. 

Thank you regardless! :up:

Edit: I REALLY need to learn to program in Java or other non-platform specific language. I've dabbled with some mainframe languages (JCL, CLIST, ReXX, Assembler) for OS/390 & z/OS being a Systems Programmer, but the architecture is a bit different on the 'frame than it is in WinTel machines. Similar, but still different...


----------



## tgrim1

darynsd said:


> I'll second that! Very responsive and I really appreciate the help!
> 
> Unfortunately for me, I have the same result as before, no video.
> 
> orangeboy- Did you get this file to work on your S3?
> tgrim1- Are you using an S3, HD or Premier?


I am using an HD.
It always bugged me, I could push them using pyTivo and it would be fine. If I streamed them then the audio was out of sync. I still have files that it fails on though.
Here is one


Code:


General
Complete name                    : G:\Streaming TV\National Geographic_ Earth Investigated - Birth Of The Universe.mkv
Format                           : Matroska
File size                        : 1.09 GiB
Duration                         : 46mn 58s
Overall bit rate                 : 3 329 Kbps
Encoded date                     : UTC 2010-03-20 17:54:39
Writing application              : mkvmerge v3.2.0 ('Beginnings') built on Feb 12 2010 16:46:17
Writing library                  : libebml v0.7.9 + libmatroska v0.8.1

Video
ID                               : 1
Format                           : AVC
Format/Info                      : Advanced Video Codec
Format profile                   : [email protected]
Format settings, CABAC           : Yes
Format settings, ReFrames        : 4 frames
Muxing mode                      : Container [email protected]
Codec ID                         : V_MPEG4/ISO/AVC
Duration                         : 46mn 58s
Bit rate                         : 3 007 Kbps
Nominal bit rate                 : 3 072 Kbps
Width                            : 1 280 pixels
Height                           : 720 pixels
Display aspect ratio             : 16:9
Frame rate                       : 25.000 fps
Resolution                       : 24 bits
Colorimetry                      : 4:2:0
Scan type                        : Progressive
Bits/(Pixel*Frame)               : 0.131
Stream size                      : 1 010 MiB (90%)
Writing library                  : x264 core 88 r1471 1144615
Encoding settings                : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=umh / subme=6 / psy=1 / psy_rd=1.00:0.00 / mixed_ref=1 / me_range=16 / chroma_me=1 / trellis=1 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=-2 / threads=12 / sliced_threads=0 / nr=0 / decimate=1 / mbaff=0 / constrained_intra=0 / bframes=3 / b_pyramid=2 / b_adapt=1 / b_bias=0 / direct=1 / wpredb=1 / wpredp=2 / keyint=250 / keyint_min=25 / scenecut=40 / intra_refresh=0 / rc_lookahead=30 / rc=2pass / mbtree=1 / bitrate=3072 / ratetol=1.0 / qcomp=0.60 / qpmin=10 / qpmax=51 / qpstep=4 / cplxblur=20.0 / qblur=0.5 / ip_ratio=1.40 / aq=1:1.00

Audio
ID                               : 2
Format                           : MPEG Audio
Format version                   : Version 1
Format profile                   : Layer 2
Codec ID                         : A_MPEG/L2
Codec ID/Hint                    : MP2
Duration                         : 46mn 58s
Bit rate mode                    : Constant
Bit rate                         : 256 Kbps
Channel(s)                       : 2 channels
Sampling rate                    : 48.0 KHz
Resolution                       : 16 bits
Video delay                      : 400ms
Stream size                      : 86.0 MiB (8%)
Title                            : Swedish
Language                         : Swedish

I dont know why mediainfo says Swedish audio and title, because it is in English


----------



## darynsd

orangeboy said:


> Unfortunately, no. I think that particular file's problem may be the level or profile of h264. I've not actually come across mkv files having <> [email protected] until that Dr. Who episode. I think both mp4creator and mp4box "supports" altering the level and/or profile:


Well, nuts. So Streambaby's chart of formats for 'Tivo Native Video Compatibility' must be wrong? It indicates an S3 should be able to accept H.264 up to level 4.1 -which I think this file is? What level and profile have you had success with in transferring to your S3?

edit: -and I just noticed that the original file is shown above to be '[email protected]'. I used mp4box. Did it change the level?


----------



## orangeboy

darynsd said:


> Well, nuts. So Streambaby's chart of formats for 'Tivo Native Video Compatibility' must be wrong? It indicates an S3 should be able to accept H.264 up to level 4.1 -which I think this file is? What level and profile have you had success with in transferring to your S3?
> 
> edit: -and I just noticed that the original file is shown above to be '[email protected]'. I used mp4box. Did it change the level?


I've never had success using mp4box, so my batch is always set to mp4creator. The mp4creator made no difference to the level reported, or to playability on my Series3 (648250). My Premiere has no problems playing the '[email protected]' file.


----------



## txporter

I am fairly certain that most of the profiles in kmttg set the level to 4.1 when transcoding to mp4. I am 99% certain that I have pushed h.264 files at level 4.1 without problem. And the BCM7401 datasheet says it can decode to level 4.1.


----------



## jcthorne

I can confirm that H.264 at level 4.1 in an mp4 file plays fine on a Tivo HD if other wise encoded correctly. That describes most of the films stored on my tivo.


----------



## darynsd

jcthorne said:


> I can confirm that H.264 at level 4.1 in an mp4 file plays fine on a Tivo HD if other wise encoded correctly. That describes most of the films stored on my tivo.


Yes, but what about the Series 3? Does anyone have the specs for its decoder chip?


----------



## orangeboy

darynsd said:


> Yes, but what about the Series 3? Does anyone have the specs for its decoder chip?


Mine is an original Series3, and plays [email protected], but not [email protected] I'd like to see if [email protected] plays on the TiVo HD...


----------



## dlfl

orangeboy said:


> Mine is an original Series3, and plays [email protected], but not [email protected] I'd like to see if [email protected] plays on the TiVo HD...


I've pushed h.264 level 3.1 to my TiVo HD and they played. They were created by Handbrake. It was critical to use the "optimize for http streaming" option in Handbrake, however. See **this**. pyTivo runs fastart which is supposed to take care of this optimization, but it wasn't working for the files I pushed.


----------



## orangeboy

dlfl said:


> I've pushed h.264 level 3.1 to my TiVo HD and they played. They were created by Handbrake. It was critical to use the "optimize for http streaming" option in Handbrake, however. See **this**. pyTivo runs fastart which is supposed to take care of this optimization, but it wasn't working for the files I pushed.


Interesting! Thanks for the reply. :up:

I found this in debug.log, relative to the [email protected] file noted earlier in this thread:


Code:


2010-04-13 16:28:29,319 DEBUG pyTivo.video.video: "\\media-center\ToTivo\Downloaded\TV\Doctor Who 2005\Doctor Who 2005.S05E01.mp4" is tivo compatible
2010-04-13 16:28:29,381 DEBUG pyTivo.video.qt-faststart: mp4 already streamable -- copying

So I don't think it's a faststart issue.


----------



## cheesesteak

orangeboy said:


> This version adds support for PAL framerates (based on Frame rate wiki) and allows for "importing" of user preferences (see the above post for details).
> 
> As always, let me know about bugs that you may uncover!


Thanks a lot for this. I finally got it running. Now, not only I can watch Doctor Who two weeks early, I can do it in hd.

It took me a while to get it working. It didn't seem to like folder names with spaces like "c:\documents and settings\user\my documents\my videos". I moved everything to a simple directory name like "c:\work" and it immediately ran a lot better. I also didn't realize that the variables for mp4creator and pyTivoMetaThis were initialized multiple times in the batch file. Once I pointed everything to the new and correct folders, everything worked fine.


----------



## orangeboy

cheesesteak said:


> Thanks a lot for this. I finally got it running. Now, not only I can watch Doctor Who two weeks early, I can do it in hd.


Glad to hear it - It's the little things in life that count! 



cheesesteak said:


> It took me a while to get it working. It didn't seem to like folder names with spaces like "c:\documents and settings\user\my documents\my videos". I moved everything to a simple directory name like "c:\work" and it immediately ran a lot better.


I find this puzzling... Most of my video folders have embedded spaces in the folder/file names. I'll have to double check the statements that deal with path names to ensure that '%~' variables are also surrounded by double quotes (where applicable)...

These are my "User Options" that were just set running a skeleton of version 6, and using the input file found at "F:\ToTivo\Don't send\Movies\Some Movie (2008)":



Code:


:Set_User_Options
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: This subroutine sets user related variables.                              ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:Required_Settings
SET aLang=English
SET sLang=English
SET eac3toPath="\\DL380-SERVER\LAN Path\exes\eac3to.exe"
SET SubtitleYN=Y
:Optional_Settings 
SET UserOPTYN=Y
SET TDPlusYN=N
SET AutoPushYN=Y
SET MetaThisYN=Y
SET UserAppYN=N
SET TDPlusPath="."
SET AutoPushPath="C:\Program Files\pyTivo Auto Push"
SET PythonPath="C:\Python26\python.exe"
SET MetaThisPath="\\DL380-SERVER\LAN Path\pyTivoMetaThis.py"
SET UserAppPath="."
:Muxer_Options
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:: You can change this setting to switch muxers if you encounter audio       ::
:: syncronization errors. Make sure to use all lowercase letters:
:: Examples:                                                                 ::
:: SET Muxer=mp4creator                                                      ::
:: SET Muxer=mp4box                                                          ::
::                                                                           ::
:: You will also need to update the appropriate path statements.             ::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
SET Muxer=mp4creator
SET mp4creatorPath="\\DL380-SERVER\LAN Path\exes\mp4creator.exe"
SET mp4boxPath="."
GOTO :EOF

Probably about as ugly as it can get, with both local and remote UNC paths!



cheesesteak said:


> I also didn't realize that the variables for mp4creator and pyTivoMetaThis were initialized multiple times in the batch file. Once I pointed everything to the new and correct folders, everything worked fine.


I'm not sure I follow - 
They should be initialized only once during the "First Run Setup". Unless those programs were moved between batch file runs?

Regardless, I am glad it's working for you now. If the details of the problems are still fresh in your mind, I was wondering if you could PM me with some of the specific folder names that were giving you trouble, so that I may be able to reproduce the problems and attempt to account for them!


----------



## cheesesteak

orangeboy said:


> I find this puzzling... Most of my video folders have embedded spaces in the folder/file names. I'll have to double check the statements that deal with path names to ensure that '%~' variables are also surrounded by double quotes (where applicable)...
> 
> _later..._
> 
> I'm not sure I follow -
> They should be initialized only once during the "First Run Setup". Unless those programs were moved between batch file runs?


Sorry I didn't keep notes. It's entirely possible that my problems stemmed from me being an idiot who didn't know what he was doing but kept messing with stuff any way. I didn't realize that the batch file was modified during the setup process.


----------



## orangeboy

cheesesteak said:


> Sorry I didn't keep notes. It's entirely possible that my problems stemmed from me being an idiot who didn't know what he was doing but kept messing with stuff any way. I didn't realize that the batch file was modified during the setup process.


No problem. It does make me think that the next version (if one comes) should come in a zip file with a "Read Me" text file included.


----------



## PeskyPete

Hi,
I'm having trouble running mkv2tivomp4.v6(.bat) on my win7 system.
The command window pops up for a sec and then disappears.
I put a pause in line 15 (before the line with the :loop command) and it displays 'version 6' but will just end when I continue.
Pesky


----------



## orangeboy

PeskyPete said:


> Hi,
> I'm having trouble running mkv2tivomp4.v6(.bat) on my win7 system.
> The command window pops up for a sec and then disappears.
> I put a pause in line 15 (before the line with the :loop command) and it displays 'version 6' but will just end when I continue.
> Pesky


Hi Pete - 
If you could, open a command prompt, and run the bat from there. I have "EXIT /B" so it will keep the command prompt window open if/when it completes. Since it's not running to completion, there should be an error message written to the command prompt window. The command to run should be similar to this:

C:\> "Your\full\path\to\mkv2tivomp4.v6.bat" "Your\full\path\to\file.to.convert.mkv"

where "Your\full\path\to" and "file.to.convert" are substituted with the proper path and filename. 

Do that, and let me know what the error is!


----------



## PeskyPete

Hi (thanks for the quick reply!)
I opened a command window, browsed to the dir with the bat file and ran it from there.
The command window now stays open.
When I run the bat, It displays:
Version: 6
then I get the prompt back, with no error messages.
...Awaiting further suggestions!
Pete


----------



## orangeboy

PeskyPete said:


> Hi (thanks for the quick reply!)
> I opened a command window, browsed to the dir with the bat file and ran it from there.
> The command window now stays open.
> When I run the bat, It displays:
> Version: 6
> then I get the prompt back, with no error messages.
> ...Awaiting further suggestions!
> Pete


Ok. This will be kinda ugly, but if you edit the .bat file, you can quickly edit out the:

@ECHO off

on line 1 by doubling up two colons in front of it:

:ECHO off

Do that, and rerun please!


----------



## PeskyPete

I get:
If ""=="" goto done
exit /b


----------



## PeskyPete

Duh - I just re-read your 1st reply to me - I'll add the proper stuff after the batch name!!


... working now, just going through the config. process.
Thanks for your help!
Pete


----------



## orangeboy

PeskyPete said:


> Duh - I just re-read your 1st reply to me - I'll add the proper stuff after the batch name!!
> 
> ... working now, just going through the config. process.
> Thanks for your help!
> Pete


Good to hear! I created another thread that describes one way to invoke the batch file using Window's SendTo folder. Another way mentioned was creating a shortcut to the batch file on your desktop, and dragging .mkv files onto it. Both methods should make using the .bat file much easier!

edit: And I hope you took the "::" from in front of the "@ECHO off"! It creates a LOT of output when echoing is suppressed...


----------



## PeskyPete

orangeboy said:


> Good to hear! I created another thread that describes one way to invoke the batch file using Window's SendTo folder. Another way mentioned was creating a shortcut to the batch file on your desktop, and dragging .mkv files onto it. Both methods should make using the .bat file much easier!


Yeah, I saw that, but I thought I would just try and get the bat file working first.
I am having issues with it still though.
It gets to the Gathering file section (lines 74 etc), then crashes at line 84.
'C:\Program Files\eac3to is not recognized as an internal command etc etc.

The path to eac3to is c:\Program Files\eac3to (correct in ini file)
Shouldn't it be running c:\Program Files\eac3to\eac3to.exe here?
Also, I haven't given it a source file name. Should I be doing that at the batch file start?


----------



## PeskyPete

I piped the output for you:


C:\Users\Peter\Desktop\Convert for tivo>SETLOCAL ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION 

C:\Users\Peter\Desktop\Convert for tivo>SET This_Program=mkv2tivomp4.v6.bat 

C:\Users\Peter\Desktop\Convert for tivo>SET This_Program_Path=C:\Users\Peter\Desktop\Convert for tivo\ 

C:\Users\Peter\Desktop\Convert for tivo>SET This_Program_Settings=mkv2tivomp4.v6.ini 

C:\Users\Peter\Desktop\Convert for tivo>SET This_Program_Version=6 

C:\Users\Peter\Desktop\Convert for tivo>PROMPT $T$G$S 

16:04:03.66> ECHO Version: 6 
Version: 6

16:04:03.66> IF "a+d.mkv" == "" GOTO Done 

16:04:03.66> CD /D "C:\Users\Peter\Desktop\Convert for tivo\" 

16:04:03.66> SET SourceFullPath=C:\Users\Peter\Desktop\Convert for tivo\A+D.mkv 

16:04:03.66> SET SourceFileName=A+D 

16:04:03.66> SET SourceFileSize=64779244 

16:04:03.66> SET SourceFilePath=C:\Users\Peter\Desktop\Convert for tivo\ 

16:04:03.66> SET OutputFullPath="C:\Users\Peter\Desktop\Convert for tivo\A+D.mp4" 

16:04:03.66> SET SourceFullName="A+D.mkv" 

16:04:03.66> SET SourceInfoName="A+D.mkv.info.txt" 

16:04:03.66> SET OutputFullName="A+D.mp4" 

16:04:03.66> SET pyMetaFullName="A+D.mp4.txt" 

16:04:03.66> SET AudioTrackName="A+D.ac3" 

16:04:03.66> SET VideoTrackName="A+D.h264" 

16:04:03.66> SET SubTrackName="A+D.srt" 

16:04:03.66> SET TempFullName="A+D.tmp" 

16:04:03.66> SET Eac3toWorkName="A+D - Log.txt" 

16:04:03.66> SET pyMetaFullPath="!SourceFilePath:~0,-1!" 

16:04:03.66> SET ShortFileSize=!SourceFileSize:~0,-1! 

16:04:03.66> CALL :Set_User_Options 2>NUL || IF !ERRORLEVEL! GTR 0 CALL :Get_User_Options 

16:04:03.68> SET aLang=English 

16:04:03.68> SET sLang=English 

16:04:03.68> SET eac3toPath="c:\Program Files\eac3to" 

16:04:03.68> SET SubtitleYN=n 

16:04:03.68> SET UserOPTYN=Y 

16:04:03.68> SET TDPlusYN=N 

16:04:03.68> SET AutoPushYN=Y 

16:04:03.68> SET MetaThisYN=N 

16:04:03.68> SET UserAppYN=N 

16:04:03.68> SET TDPlusPath="." 

16:04:03.68> SET AutoPushPath="." 

16:04:03.68> SET PythonPath="." 

16:04:03.68> SET MetaThisPath="." 

16:04:03.68> SET UserAppPath="." 

16:04:03.68> SET Muxer=mp4creator 

16:04:03.68> SET mp4creatorPath="c:\Program Files\mkvtoolnix" 

16:04:03.68> SET mp4boxPath="." 

16:04:03.68> GOTO :EOF 

16:04:03.68> CLS

16:04:03.68> CALL :Initialize_Vars ac3_channels ac3_channels_score ac3_kbps ac3_kbps_score ac3_kbps_diff ac3_kbps_diff_score ac3_freq ac3_freq_score ac3_score 

16:04:03.68> FOR %C in (ac3_channels ac3_channels_score ac3_kbps ac3_kbps_score ac3_kbps_diff ac3_kbps_diff_score ac3_freq ac3_freq_score ac3_score) DO (SET /A %C=0 ) 

16:04:03.68> (SET /A ac3_channels=0 ) 

16:04:03.68> (SET /A ac3_channels_score=0 ) 

16:04:03.68> (SET /A ac3_kbps=0 ) 

16:04:03.68> (SET /A ac3_kbps_score=0 ) 

16:04:03.68> (SET /A ac3_kbps_diff=0 ) 

16:04:03.68> (SET /A ac3_kbps_diff_score=0 ) 

16:04:03.68> (SET /A ac3_freq=0 ) 

16:04:03.68> (SET /A ac3_freq_score=0 ) 

16:04:03.68> (SET /A ac3_score=0 ) 

16:04:03.68> GOTO :EOF 

16:04:03.68> CALL :Initialize_Vars dts_channels dts_channels_score dts_kbps dts_kbps_score dts_kbps_diff dts_kbps_diff_score dts_freq dts_freq_score dts_score 

16:04:03.69> FOR %C in (dts_channels dts_channels_score dts_kbps dts_kbps_score dts_kbps_diff dts_kbps_diff_score dts_freq dts_freq_score dts_score) DO (SET /A %C=0 ) 

16:04:03.69> (SET /A dts_channels=0 ) 

16:04:03.69> (SET /A dts_channels_score=0 ) 

16:04:03.69> (SET /A dts_kbps=0 ) 

16:04:03.69> (SET /A dts_kbps_score=0 ) 

16:04:03.69> (SET /A dts_kbps_diff=0 ) 

16:04:03.69> (SET /A dts_kbps_diff_score=0 ) 

16:04:03.69> (SET /A dts_freq=0 ) 

16:04:03.69> (SET /A dts_freq_score=0 ) 

16:04:03.69> (SET /A dts_score=0 ) 

16:04:03.69> GOTO :EOF 

16:04:03.69> ECHO.


16:04:03.69> ECHO Gathering file information. Please wait... 
Gathering file information. Please wait...

16:04:03.69> ECHO.


16:04:03.69> SET h264_ID= 

16:04:03.69> SET ac3_ID= 

16:04:03.69> SET dts_ID= 

16:04:03.69> SET sID= 

16:04:03.69> IF EXIST "A+D.mkv.info.txt" DEL "A+D.mkv.info.txt" 

16:04:03.69> IF EXIST "A+D.tmp" DEL "A+D.tmp" 

16:04:03.69> "c:\Program Files\eac3to" "A+D.mkv" | FINDSTR /R "1:\> 2:\> 3:\> 4:\> 5:\> 6:\> 7:\> 8:\> 9:\> 1.:\> 2.:\>" 1>>"A+D.tmp"


----------



## orangeboy

PeskyPete said:


> Yeah, I saw that, but I thought I would just try and get the bat file working first.
> I am having issues with it still though.
> It gets to the Gathering file section (lines 74 etc), then crashes at line 84.
> 'C:\Program Files\eac3to is not recognized as an internal command etc etc.
> 
> The path to eac3to is c:\Program Files\eac3to (correct in ini file)
> Shouldn't it be running c:\Program Files\eac3to\eac3to.exe here?


Yes. I believe if "eac3to.exe" cannot be found in the system environment variable "%path%", it prompts:

Enter the full path (*including file name and extension*) to ...

I'm actually surprised that the config portion left out the "eac3to.exe", or allowed the batch to proceed without it. The easiest way to fix this is to edit the .ini file, and delete the last 34 lines of the batch. There a box that looks like this that will confirm you are at the right spot:



Code:


::---------------------------------------------------------------------------::
::------                                                               ------::
::---     DELETE ALL LINES BELOW THIS BOX TO RE-RUN USER OPTION SETUP     ---::
::------                                                               ------::
::---------------------------------------------------------------------------::

Edit - just read your previous post. mp4creatorPath="c:\Program Files\mkvtoolnix" will need to be fixed, too. Also, wrapping the output in that post with [.code] [./code] (minus the dots) would make the post a lot smaller.  But I appreciate seeing what you're seeing!

Or you could delete the .ini file, delete those same lines, and rerun the batch...



PeskyPete said:


> Also, I haven't given it a source file name. Should I be doing that at the batch file start?


The source file name is taken care of when the batch was invoked. It's passed as "%1", which earlier gave the problem with:

If ""=="" goto done

So no problems there!


----------



## PeskyPete

I re-ran the setup and included filenames, not just paths. Had to rename pyTivoMetaThis-0.22.py to pyTivoMetaThis.py also.
Now it runs without a problem
Thanks again for your help!
(I'll pay more attention to the instructions from now on.... honest)!


----------



## orangeboy

PeskyPete said:


> I re-ran the setup and included filenames, not just paths. Had to rename pyTivoMetaThis-0.22.py to pyTivoMetaThis.py also.
> Now it runs without a problem
> Thanks again for your help!
> (I'll pay more attention to the instructions from now on.... honest)!


Good deal!
I've never tested it on Win 7, so it's nice to know it works there, too.


----------



## tgrim1

jimmy8765 said:


> PS:For h264 playback, the Tivo decoder has a bug with the aspect ratio used to display any 1280 based video that is not 1280x720 exactly. So for example 1280x720 displays fine but 1280x544 does not. 1920 based video does not suffer from the same kind of problem.


Its weird but I have some 1280x(non720) that stream just fine and others that do not


----------



## jcthorne

You can stream h.264 video? Or is streambaby converting on the fly to mpeg2 for you?

As far as I knew, we could only push h.264 video to tivo and keep it native.


----------



## tgrim1

jcthorne said:


> You can stream h.264 video? Or is streambaby converting on the fly to mpeg2 for you?


Good question, how do I tell the difference?


----------



## orangeboy

tgrim1 said:


> Good question, how do I tell the difference?


Look for ffmpeg using a lot of CPU when streaming...


----------



## wmcbrine

jcthorne said:


> You can stream h.264 video?


Yes.



> _Or is streambaby converting on the fly to mpeg2 for you?_


It can, but it doesn't necessarily have to.



> _As far as I knew, we could only push h.264 video to tivo and keep it native._


You can push it, or you can stream it. What you can't do is pull it to the NPL, HMO-style. (Although there may be a way around that, for the Premiere.)


----------



## PeskyPete

probably off topic slightly, but...
I can push an mkv to Tivo (S3 HD), but the aspect ratio on some files gets changed.
Maybe my tv is doing it, but I can change it to display correctly by using the tv screen function, but then I am zoomed in to the picture.
I tried taking the same file and re-muxing it with the mkv2tivomp4.v6.bat.
It came over with the correct aspect ratio, but it was zoomed in even more than when I did it (zoomed in) to the original file.
Also, how do I tell the resolution (XxY) of a video? WMP doesn't give that info out.
I have VideoReDo, but that doesn't work with avi's. VRD does take a H264 and very quickly (5 mins for a 2 hou file) converts it to MPEG2, which can be pushed to Tivo.
Pesky


----------



## tgrim1

orangeboy said:


> Look for ffmpeg using a lot of CPU when streaming...


Okay, I checked and they (the 1280xnon720 files) are definitely streaming. ffmpeg only runs if I watch a avi file with streambaby.

This is one that streams perfectly fine...


Code:


General
Complete name                    : G:\Streaming Movies\The Curious Case of Benjamin Button (2008).mp4
Format                           : MPEG-4
Format profile                   : Base Media / Version 2
Codec ID                         : mp42
File size                        : 6.68 GiB
Duration                         : 2h 46mn
Overall bit rate                 : 5 763 Kbps
Encoded date                     : UTC 2010-01-11 11:53:10
Tagged date                      : UTC 2010-01-11 12:02:01
Writing application              : mp4creator 1.6.1d

Video
ID                               : 1
Format                           : AVC
Format/Info                      : Advanced Video Codec
Format profile                   : [email protected]
Format settings, CABAC           : Yes
Format settings, ReFrames        : 5 frames
Codec ID                         : avc1
Codec ID/Info                    : Advanced Video Coding
Duration                         : 2h 46mn
Bit rate mode                    : Variable
Bit rate                         : 5 312 Kbps
Width                            : 1 280 pixels
Height                           : 528 pixels
Display aspect ratio             : 2.40:1
Frame rate mode                  : Constant
Frame rate                       : 23.976 fps
Resolution                       : 24 bits
Colorimetry                      : 4:2:0
Scan type                        : Progressive
Bits/(Pixel*Frame)               : 0.328
Stream size                      : 6.16 GiB (92%)
Language                         : English
Encoded date                     : UTC 2010-01-11 11:53:10
Tagged date                      : UTC 2010-01-11 11:57:13

Audio
ID                               : 2
Format                           : AC-3
Format/Info                      : Audio Coding 3
Codec ID                         : ac-3
Duration                         : 2h 46mn
Bit rate mode                    : Constant
Bit rate                         : 448 Kbps
Channel(s)                       :  channel0
Stream size                      : 532 MiB (8%)
Language                         : English
Encoded date                     : UTC 2010-01-11 12:01:43
Tagged date                      : UTC 2010-01-11 12:02:00

This one is squished into a 4:3 box...


Code:


General
Complete name                    : G:\Streaming Movies\New Folder\The Notebook (2004).mp4
Format                           : MPEG-4
Format profile                   : Base Media / Version 2
Codec ID                         : mp42
File size                        : 4.21 GiB
Duration                         : 2h 3mn
Overall bit rate                 : 4 865 Kbps
Encoded date                     : UTC 2010-01-11 21:03:10
Tagged date                      : UTC 2010-01-11 21:08:18
Writing application              : mp4creator 1.6.1d

Video
ID                               : 1
Format                           : AVC
Format/Info                      : Advanced Video Codec
Format profile                   : [email protected]
Format settings, CABAC           : Yes
Format settings, ReFrames        : 5 frames
Codec ID                         : avc1
Codec ID/Info                    : Advanced Video Coding
Duration                         : 2h 3mn
Bit rate mode                    : Variable
Bit rate                         : 4 415 Kbps
Width                            : 1 280 pixels
Height                           : 544 pixels
Display aspect ratio             : 2.35:1
Frame rate mode                  : Constant
Frame rate                       : 23.976 fps
Resolution                       : 24 bits
Colorimetry                      : 4:2:0
Scan type                        : Progressive
Bits/(Pixel*Frame)               : 0.264
Stream size                      : 3.82 GiB (91%)
Language                         : English
Encoded date                     : UTC 2010-01-11 21:03:10
Tagged date                      : UTC 2010-01-11 21:05:18

Audio
ID                               : 2
Format                           : AC-3
Format/Info                      : Audio Coding 3
Codec ID                         : ac-3
Duration                         : 2h 3mn
Bit rate mode                    : Constant
Bit rate                         : 448 Kbps
Channel(s)                       :  channel0
Stream size                      : 397 MiB (9%)
Language                         : English
Encoded date                     : UTC 2010-01-11 21:08:04
Tagged date                      : UTC 2010-01-11 21:08:18


----------



## txporter

PeskyPete said:


> probably off topic slightly, but...
> I can push an mkv to Tivo (S3 HD), but the aspect ratio on some files gets changed.
> Maybe my tv is doing it, but I can change it to display correctly by using the tv screen function, but then I am zoomed in to the picture.
> I tried taking the same file and re-muxing it with the mkv2tivomp4.v6.bat.
> It came over with the correct aspect ratio, but it was zoomed in even more than when I did it (zoomed in) to the original file.
> Also, how do I tell the resolution (XxY) of a video? WMP doesn't give that info out.
> I have VideoReDo, but that doesn't work with avi's. VRD does take a H264 and very quickly (5 mins for a 2 hou file) converts it to MPEG2, which can be pushed to Tivo.
> Pesky


Download MediaInfo. I can give you that info.


----------



## PeskyPete

I figured out that I can resize the video properly using the re-size button on the tivo remote instead of my TV... Who knew? Apparrently not me 

I have another q.
I am now getting a message at the end of running the MKV2TIVOMP4 bat file:
Please choose the correct seriesid:
It doesn't appear all the time, but when it does, a whole list of movie ID's appears and my show is either not in the list, or I can't read it beacause it's scrolled past the command window (buffer size?)
Can I ignore this everytime? Can I disable this option? Should I?
The shows still play when I don't enter an id so I guess it's no big deal...


----------



## orangeboy

PeskyPete said:


> ...I am now getting a message at the end of running the MKV2TIVOMP4 bat file:
> Please choose the correct seriesid:
> It doesn't appear all the time, but when it does, a whole list of movie ID's appears and my show is either not in the list, or I can't read it beacause it's scrolled past the command window (buffer size?)
> Can I ignore this everytime? Can I disable this option? Should I?
> The shows still play when I don't enter an id so I guess it's no big deal...


That is a pyTivoMetaThis message. Check out this post, and those following it for an explanation of what it means, and perhaps what to do: http://pytivo.sourceforge.net/forum/post8610.html#8610


----------



## PeskyPete

Thanks Orangeboy.
That's a huge thread. I really don't have time to go through it all, so I will assume that this happens on some files and not all, but can be ignored.
(For now anyway).
I'm getting the odd green screen of death on my Tivo HD (couple times a week?), so I need to figure out why/what etc. that now... 
Pesky


----------



## innocentfreak

wmcbrine said:


> You can push it, or you can stream it. What you can't do is pull it to the NPL, HMO-style. (Although there may be a way around that, for the Premiere.)


Is there any update on the possibility of pulling via the NPL?


----------



## jcthorne

innocentfreak said:


> Is there any update on the possibility of pulling via the NPL?


Tivo cannot pull h.264 video from the NPL. Its a tivo limitation in the current software revision.


----------



## innocentfreak

jcthorne said:


> Tivo cannot pull h.264 video from the NPL. Its a tivo limitation in the current software revision.


Oh ok. From his wording I wasnt sure on the Premiere how it was limited and didnt know if it was something that hadnt been figured out yet. I guess I need to look into a pc in the other room so I can also push from there.


----------



## wmcbrine

jcthorne said:


> Tivo cannot pull h.264 video from the NPL.


Don't be so sure.


----------



## Spenner

wmcbrine said:


> Don't be so sure.


Elaborate, please?


----------



## wmcbrine

I prefer to remain mysterious at this time.


----------



## innocentfreak

wmcbrine said:


> I prefer to remain mysterious at this time.


Damn you lol.

I guess I will hold off on buying a media streamer for now.


----------



## wmcbrine

Seriously, I just don't want to get anyone's hopes up, but it's already been discussed here in other threads. The idea is to send h.264 video in a transport stream with an unencrypted .TiVo header. I believe someone already successfully sent an h.264 .TiVo file that originated from a New Zealand TiVo to a Premiere. There's a lot of work needed to make this transparent, and so far, one of the key elements -- remuxing from MP4 containers to transport streams with ffmpeg -- is not working for me. (I get the dreaded non-monotone timestamp errors.)


----------



## innocentfreak

I definitely appreciate the effort and hope to see it working one day.


----------



## txporter

wmcbrine said:


> Seriously, I just don't want to get anyone's hopes up, but it's already been discussed here in other threads. The idea is to send h.264 video in a transport stream with an unencrypted .TiVo header. I believe someone already successfully sent an h.264 .TiVo file that originated from a New Zealand TiVo to a Premiere. There's a lot of work needed to make this transparent, and so far, one of the key elements -- remuxing from MP4 containers to transport streams with ffmpeg -- is not working for me. (I get the dreaded non-monotone timestamp errors.)


Can you make it work if it is already in a ts container?


----------



## Spenner

Ditto on txporter's point - if "we" are already in the habit of pre-processing h.264 videos for the push criteria, would pull work if we already put the video into the container format you need?

Also, would the muxing be any easier if the h.264 sources are MKV instead of MP4, which is probably what they're starting as.


----------



## orangeboy

I believe this is a thread of interest: http://tivocommunity.com/tivo-vb/showthread.php?t=446048


----------

