[mythtv-users] Mythweb flowplayer progressive download

Justin Johnson justin.johnson3 at gmail.com
Thu Dec 17 18:55:39 UTC 2009

About a month ago I posted on here asking for ideas on how to get the flash
player in mythweb to stream content. I didn't get much of a response, and I
guess I wasn't really clear about what I was trying to do. I was not trying
to implement pseudostreaming, but merely trying to get the player to give
the same behavior as a normal progressively downloaded flash video. When I
would watch a video if I wanted to go back a few seconds it would cause the
entire video to start over. I'm pleased to say that I've got a fix working
so that this doesn't happen. Unfortunately, it wasn't just a patch to
mythtv, I also needed to patch ffmpeg to get it working. This fix allows you
to seek anywhere in the part of the video that has already been downloaded
from the server. There were two things required:
1) ffmpeg had to write the duration header tag in the flv BEFORE it wrote
the entire file. To do this, I guessed that the resulting transcode would be
the same duration as the input file. I left the code that sets the duration
after the transcode finishes so that if this guess isn't right, it gets
overwritten. This might have screwed up how ffmpeg handles other files, but
I don't use ffmpeg for anything else so I don't really know.
2) The content-length http header had to be sent. To do this, I (again)
guessed at what the final filesize would by by taking the average audio and
video bitrates and multiplying by the above duration of the video. This
works well, but isn't perfect as the resulting file is usually smaller than
this amount. If anyone know of a better way of doing this please let me

I'd appreciate if people could test out my code and give me some feedback.
I've posted it here: http://netfiles.uiuc.edu/jjohns63/www/ffmpeg.diff and
here: http://netfiles.uiuc.edu/jjohns63/www/stream_flv.pl.diff

You need to patch the /mythweb/modules/stream/stream_flv.pl file in your
/var/www directory. Also ffmpeg must be patched, both ffmpeg.c and
libavformats/flvenc.c. In the new stream_flv.pl you should set the $ffmpeg
value on the first line to the directory of your patched ffmpeg.
--Justin Johnson
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mythtv.org/pipermail/mythtv-users/attachments/20091217/e10e0046/attachment.htm>

More information about the mythtv-users mailing list