pyTivo Discussion Forum Forum Index pyTivo Discussion Forum
Answers and the development of pyTivo a TiVo transcoding server
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

A simple hack: playing audios as videos

 
Post new topic   Reply to topic    pyTivo Discussion Forum Forum Index -> Hacks
 View previous topic :: View next topic  
Author Message
pje



Joined: 02 Apr 2008
Posts: 3

PostPosted: Mon Aug 11, 2008 3:14 pm    Post subject: A simple hack: playing audios as videos Reply with quote

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
View user's profile Send private message Visit poster's website
Minckster



Joined: 02 Oct 2008
Posts: 21

PostPosted: Wed Oct 22, 2008 6:03 am    Post subject: Re: A simple hack: playing audios as videos Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    pyTivo Discussion Forum Forum Index -> Hacks All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
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
Site is in NO WAY affiliated with TiVo Inc

Powered by phpBB © 2001, 2005 phpBB Group
phpBB SEO
[ Time: 0.9247s ][ Queries: 13 (0.4414s) ][ Debug on ]