Opened 14 years ago
Closed 14 years ago
#8017 closed enhancement (fixed)
Fix mythweb flash streaming to behave like a progressive download
Reported by: | Owned by: | Rob Smith | |
---|---|---|---|
Priority: | minor | Milestone: | unknown |
Component: | Plugin - MythWeb | Version: | unknown |
Severity: | medium | Keywords: | |
Cc: | Ticket locked: | no |
Description
Attached patch allows the flash streaming flowplayer to behave like a progressive download. You can seek to any position in the video which has been downloaded. Note that you cannot seek to arbitrary points which have not yet been sent from the server.
This patch requires ffmpeg > r21615
This patch also addresses ticket #7538
Attachments (2)
Change History (9)
Changed 14 years ago by
Attachment: | mythweb.diff added |
---|
comment:1 Changed 14 years ago by
comment:2 follow-up: 3 Changed 14 years ago by
As a clarification, I am using the latest ffmpeg which exceeds the revision listed (built from trunk today) but it appears the flv itself does not have a duration set in the header which could be a culprit.
comment:3 Changed 14 years ago by
Replying to scottadmi@…:
As a clarification, I am using the latest ffmpeg which exceeds the revision listed (built from trunk today) but it appears the flv itself does not have a duration set in the header which could be a culprit.
It looks like the patch I submitted to ffmpeg was reverted in revision r21652. It looks like I made some assumptions that were incorrect. I haven't gotten around to investigating another method of doing this. I'll post here when I do.
comment:4 Changed 14 years ago by
I found a work around which doesn't require changes to ffmpeg. Its very rough code (as perl is not a language I work with much), but it works. The gist of it, is simply writing the duration data directly to the output stream at the appropriate place in the flv export (effectively overwriting the location which has a zero generated by ffmpeg).
This code snippet replaces the end of stream_flv.pl
# Guess the filesize based on duration and bitrate. This allows for progressive download behavior my $lengthSec; $dur = `ffmpeg -i $filename 2>&1 | grep "Duration" | cut -d ' ' -f 4 | sed s/,//`; if ($dur && $dur =~ /\d*:\d*:.*/) { @times = split(':',$dur); $lengthSec = $times[0]*3600+$times[1]*60+$times[2]; $size = int($lengthSec*($vbitrate*1000+$abitrate*1000)/8); print header(-type => 'video/x-flv','Content-Length' => $size); } else { print header(-type => 'video/x-flv'); } my $buffer; if (read DATA, $buffer, 53) { print $buffer; read DATA, $buffer, 8; $durPrint = reverse pack("d",$lengthSec); // change endian print $durPrint; while (read DATA, $buffer, 262144) { print $buffer; } } close DATA;
This could certainly be made cleaner, but it works well for now.
comment:6 Changed 14 years ago by
As an additional note, I've discovered that the duration returned by ffmpeg for .nuv (nuppelvideo) files which contain mpeg4 recordings produce extremely exaggerated durations (the HD recordings do not have this problem). Since I do not have the expertise to address this, I added a line two divide the duration given for nuv files by 21. This does not produce an exactly correct duration, but it is usually within a couple minutes (so the duration will be 33 min. instead of 12 hours).
This fix does not seem to work for my setup. An estimated size comes through when transferring the flv (confirmed by trying to download the flv stream directly) - however despite this, clicking any point in the flow player even parts which have already been played simply restarts the playback at 0. Any ideas?