 |
pyTivo Discussion Forum Answers and the development of pyTivo a TiVo transcoding server
|
|
| Author |
Message |
pje
Joined: 02 Apr 2008 Posts: 3
|
Posted: Mon Aug 11, 2008 3:14 pm Post subject: A simple hack: playing audios as videos |
|
|
I have a lot of MP3s that are seminar and workshop recordings, which are a pain to play in Windows Media Player or using the Tivo's music functions. You don't get instant replay, and you can't save your place so that you can do something else and then come back where you left off.
So yesterday I came up with a little hack for pyTivo to let it treat audio files as if they were video files. Basically, you add '.mp3' (and whatever else) to your 'video.ext' file, and then make a few minor changes to transcode.py.
Specifically, you have to change the video_info() function to have a codec of 'none' when the file doesn't have a video codec, to default width and height to 720x480, and fps to '29.97'. Then, after all the regex checks are done, you check whether "acodec is None and codec=='none'", and if so, bail out with a bunch of None's (after caching that, of course).
That change makes it so that audio files will be treated as video files, and any files that are neither video nor audio will be ignored, as before.
The second change you need to make is in the transcode function, changing the existing command line creation to:
| Code: | cmd = [ffmpeg_path(), '-i', inFile]
type, width, height, fps, millisecs, kbps, akbps, acodec, afreq, vpar = \
video_info(inFile)
if type=='none':
cmd += ['-loop_input', '-i', r'SomeImgage.gif', '-t', '%.3f'%(millisecs/1000.0)]
cmd += cmd_string.split()
|
Replacing "SomeImage.gif" with the full path to some image file. Basically, this takes the image file and loops it for the full length of the audio, making that the video channel of what's sent to the Tivo. It's not ideal, in that I think the aspect ratio is off in some way. I haven't played with that much. If you just use an all-black image, though, I don't imagine it will make a difference.
Anyway, it seems to work for me. (The -t part to specify the duration is essential, as without it, ffmpeg keeps generating video forever and the transfer never finishes.) |
|
| Back to top |
|
 |
Minckster
Joined: 02 Oct 2008 Posts: 21
|
Posted: Wed Oct 22, 2008 6:03 am Post subject: Re: A simple hack: playing audios as videos |
|
|
Could you provide your entire hacked trancode.py file? I don't understand what you mean by the following: | pje wrote: | Specifically, you have to change the video_info() function to have a codec of 'none' when the file doesn't have a video codec, to default width and height to 720x480, and fps to '29.97'. Then, after all the regex checks are done, you check whether "acodec is None and codec=='none'", and if so, bail out with a bunch of None's (after caching that, of course). | I don't need the "+/-" signs indicating your edits -- I can figure that out -- just copying and pasting your hacked file would help a lot. |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum You cannot attach files in this forum You cannot download files in this forum
|
|