@echo off
set BIFTOOL="C:\Users\Home\Tivo\roku\biftool.exe"
set FFMPEG="C:\Users\Home\Tivo\ffmpeg\ffmpeg.exe"
set TIVODATA="C:\Users\Home\Tivo\Data"
set TIVOFILE=%1
cd %TIVODATA%
for %%i in (%TIVOFILE%) do set NEWFOLDER="%%~ni"
echo Processing %TIVOFILE% into %NEWFOLDER%...
mkdir %NEWFOLDER%
echo %FFMPEG% -i %TIVOFILE% -r .1 -s 320x240 %NEWFOLDER%\%%010.jpg
%FFMPEG% -i %TIVOFILE% -r .1 -s 320x240 %NEWFOLDER%\%%08d.jpg
cd %NEWFOLDER%
cd ..
%BIFTOOL% -t 10000 %NEWFOLDER%
del %TIVODATA%\%NEWFOLDER%\*.jpg
rmdir %NEWFOLDER%
import glob
import string
import os
#get all the jpg file names in the current folder
files = glob.glob("*.jpg")
#sort the list
files.sort()
count = -1
# and rename each file
for f in files:
count = count + 1
n = string.zfill(count,4) + ".jpg"
print f, n,
try:
os.rename(f, n)
except:
print "error: didn't rename"
@echo off
cls
set BIFTOOL="C:\Users\Home\Tivo\roku\biftool.exe"
set FFMPEG="C:\Users\Home\Tivo\ffmpeg\ffmpeg.exe"
set JPGRENAMER="C:\Users\Home\Tivo\jpgrenamer.py"
set TIVODATA="C:\Users\Home\Tivo\Data"
set TIVOFILE=%1
cd %TIVODATA%
for %%i in (%TIVOFILE%) do set NEWFOLDER="%%~ni"
echo Processing %TIVOFILE% into %NEWFOLDER%...
mkdir %NEWFOLDER%
echo %FFMPEG% -i %TIVOFILE% -r .1 -s 320x240 %NEWFOLDER%\%%010.jpg
%FFMPEG% -i %TIVOFILE% -r .1 -s 320x240 %NEWFOLDER%\%%08d.jpg
cd %NEWFOLDER%
del 00000001.jpg
%JPGRENAMER%
cd ..
%BIFTOOL% -t 10000 %NEWFOLDER%
del %TIVODATA%\%NEWFOLDER%\*.jpg
rmdir %NEWFOLDER%
"muirhejs" wrote:What are you using for the encoding parameters? I ended up with a/v sync drift the last time I used kmttg (and ffmpeg by itself) to do the encoding. Also, what's your ffmpeg version(any special build tweaks?)? I'd love to use kmttg for prepping files for roku!
Just in case anyone else is looking to use their Tivo shows with RoksBox, MyMedia, or similar. I've had great success with kmttg, but the one thing that was troubling me a bit was that when fast forwarding / rewinding, I didn't get any previews of where in the show it was. So I've put together a really simple Windows batch file to be used with kmttg's "custom command" option, i.e. "C:\Users\Home\Tivo\bifcreate.cmd [encodeFile]" in my case...
Here it is for anyone interested. Be warned that the sync between the video and the preview images is not great, but likely passable if you're not too picky!
@echo off
set BIFTOOL="C:\Users\Home\Tivo\roku\biftool.exe"
set FFMPEG="C:\Users\Home\Tivo\ffmpeg\ffmpeg.exe"
set TIVODATA="C:\Users\Home\Tivo\Data"
set TIVOFILE=%1
cd %TIVODATA%
for %%i in (%TIVOFILE%) do set NEWFOLDER="%%~ni"
echo Processing %TIVOFILE% into %NEWFOLDER%...
mkdir %NEWFOLDER%
echo %FFMPEG% -i %TIVOFILE% -r .1 -s 320x240 %NEWFOLDER%\%%010.jpg
%FFMPEG% -i %TIVOFILE% -r .1 -s 320x240 %NEWFOLDER%\%%08d.jpg
cd %NEWFOLDER%
cd ..
%BIFTOOL% -t 10000 %NEWFOLDER%
del %TIVODATA%\%NEWFOLDER%\*.jpg
rmdir %NEWFOLDER%
- John
# Description (single line, keep short)
<description>
Handbrake tivo hd: mp4 container, h.264 video, aac audio, br2500
# Encode command or script (single line)
# Known keywords: FFMPEG, MENCODER, HANDBRAKE, PERL, INPUT, OUTPUT, PWD, CPU_CORES, SRTFILE
<command>
HANDBRAKE -i INPUT --cpu CPU_CORES -f mp4 --large-file --decomb --detelecine -O --encoder x264 -w 960 -b 1500 -r 29.97 -a 1 --aencoder faac --ab 160 --mixdown dpl12 --arate 48 --drc 0.0 --x264opts ref=2:bframes=2:subq=6:mixed-refs=0:weightb=0:8x8dct=0:trellis=0 -v -o OUTPUT
# Encoded output file extension
<extension>
m4v
FFmpeg version SVN-r21085, Copyright (c) 2000-2010 Fabrice Bellard, et al. built on Jan 8 2010 06:05:02 with gcc 4.2.4
configuration: --enable-memalign-hack --prefix=/mingw --cross-prefix=i686-mingw32- --cc=ccache-i686-mingw32-gcc --target-os=mingw32 --arch=i686 --cpu=i686 --enable-avisynth --enable-gpl --enable-version3 --enable-zlib --enable-bzlib --enable-libgsm --enable-libfaad --enable-pthreads --enable-libvorbis --enable-libtheora --enable-libspeex --enable-libmp3lame --enable-libopenjpeg --enable-libxvid
--enable-libschroedinger --enable-libx264 --enable-libopencore_amrwb --enable-libopencore_amrnb
libavutil 50. 7. 0 / 50. 7. 0
libavcodec 52.45. 0 / 52.45. 0
libavformat 52.46. 0 / 52.46. 0
libavdevice 52. 2. 0 / 52. 2. 0
libswscale 0. 8. 0 / 0. 8. 0
C:\Users\Home\Tivo\handbrake>HandBrakeCLI.exe -u
[11:22:20] hb_init: checking for updates
[11:22:20] Using http://handbrake.fr/appcast.xml
[11:22:20] latest: 0.9.5, build 2011010300
[11:22:21] hb_init: checking cpu count
[11:22:21] hb_init: starting libhb thread
HandBrake 0.9.5 (2011010300) - MinGW i386 - http://handbrake.fr
Your version of HandBrake is up to date.
@echo off
:: bifcreate.cmd v0.1
:: Given an .m4v file, use ffmpeg and biftool to
:: create a bif file for the video, and organize the
:: output if desired
:: Requires python for 'jpgrenamer.py' because I'm lazy
:: Set main directories & files here
set BIFTOOL="C:\Users\Home\Tivo\roku\biftool.exe"
set FFMPEG="C:\Users\Home\Tivo\ffmpeg\ffmpeg.exe"
set JPGRENAMER="C:\Users\Home\Tivo\jpgrenamer.py"
set TIVODATA=C:\Users\Home\Tivo\Data
set TIVOFILE=%1
cd "%TIVODATA%"
:: Extract temporary folder name we'll use
for %%i in (%TIVOFILE%) do set NEWFOLDER=%%~ni
:: Extract the series name so we can place the output into an
:: appropriately named subfolder if necessary
for /f "tokens=1 delims=-" %%a in (%TIVOFILE%) do set SHOWNAME=%%a
:: Extract the name of the BIF file to check and see if it's already been created
for %%i in (%TIVOFILE%) do set BIFFILE=%%~ni.bif
if exist "%BIFFILE%" goto EXIT
echo Processing %TIVOFILE% into %NEWFOLDER%...
mkdir "%TIVODATA%\temp\%NEWFOLDER%"
:: Extract a JPG every 10 seconds and place it in the temp folder we created
%FFMPEG% -v 0 -i %TIVOFILE% -r .1 -s 320x240 "%TIVODATA%\temp\%NEWFOLDER%\%%08d.jpg"
cd "%TIVODATA%\temp\%NEWFOLDER%"
:: FFMPEG duplicates the first file
del 00000001.jpg
:: Now we have to rename all the files to properly align them for BIFTool
%JPGRENAMER%
cd "%TIVODATA%"
:: Run Biftool
%BIFTOOL% -t 10000 "%TIVODATA%\temp\%NEWFOLDER%"
:: Cleanup
del "%TIVODATA%\temp\%NEWFOLDER%\*.jpg"
rmdir "%TIVODATA%\temp\%NEWFOLDER%"
:: Put the episode in a folder for the series if one exists
if exist "%SHOWNAME%" move "%TIVODATA%\%NEWFOLDER%*" "%SHOWNAME%"
:EXIT