[mythtv] trick modes in live tv
Robert Johnston
anaerin at gmail.com
Fri Jun 18 19:44:11 UTC 2010
On 18/06/2010 5:14 AM, Multimedia King wrote:
> Dear all,
>
> I am new to Myth-TV but not to PVR implementation.
> Here I am trying to implement time-shift live tv pvr feature in my
> application. I could develop the feature of maintaining the ring buffer
> and pause/play feature in this. I want to implement trick modes(fast
> forward/fast rewind) feature in this model with N minutes. Myth TV
> already does this, but I can't use whole mythtv in my project.
> could you please let me know where should I start tweaking/looking in to
> the code in mythtv project for linux to implement this trickmodes
> feature in Live-TV (time shift for N minutes).
I'm really not sure that this is the best place to ask, but I'll see if
I can help with an overview of what I think you need.
Essentially, what you are looking at is a recording model that has been
abandoned in MythTV. Myth used to use a ringbuffer system system for
live TV, but it has since moved on to full PVR recording from the
instant that is asked.
What you need to do is to have 3 threads running. One records TV to a
file, one plays back that file (And does fast-forward and rewind), and
the last deletes from the end of the file. The deleting thread will only
delete data that is x minutes old (adjustable, this is the length of
your ringbuffer), but also will not delete beyond the playback point (So
if you have the system set up for an hour-long ringbuffer, and someone
pauses and walks away for 90 minutes, the playback point isn't deleted).
In theory, you could achieve something like what you want fron a command
prompt like this:
cat /dev/video0 | split -b 32 m - Ringbuffer &
echo tmpwatch 1 `pwd` >/etc/cron.hourly
mplayer Ringbuffer*
This would record the input of /dev/video0 to files, splitting every
32mb, and use mplayer to play back those files. The splitting would then
make it easier for the hourly cron job to delete stale files. I'm not
sure if mplayer will pick up new files that match if they're created
after it starts, so that might need to be looked at. But that's
essentially the basics of what you need. If you already have a system
that handles playback properly (with fast-forward and rewind) then you
have everything you need. If you don't, may I suggest you look at the
mplayer, ffmpeg or vlc projects, as they all do what you need and are
less complicated than Myth.
I hope this helps you some.
More information about the mythtv-dev
mailing list