GNOME Bugzilla – Bug 751320
flvmux: Does not append AVC end of sequence
Last modified: 2015-06-22 22:50:15 UTC
Please try this pipeline:
gst-launch-1.0 videotestsrc pattern=18 num-buffers=1000 ! openh264enc ! h264parse ! flvmux ! filesink location=/tmp/test.flv
and now try to play the generated flv with flowplayer, here you can find a sample flowplayer test page:
the player will freeze about at second 25, if you seek to another position the play resume.
This happen for me with real world file quite often, the freeze position is not predeterminated.
If you remux the file with ffmpgeg (both the test file and the real world one), flowplayer will play with no freeze
One thing I observe is that ffmpeg seems to append a "dummy" frame at the end. I would need to refer to the spec, but the relevant log is:
gstflvdemux.c:1620:gst_flv_demux_parse_tag_video:<flvdemux0> pushing 115 bytes buffer at dts 0:00:33.266000000 with duration 99:99:99.999999999, offset 999, keyframe (0)
gstflvdemux.c:1761:gst_flv_demux_parse_tag_type:<flvdemux0> tag data size is 5
gstflvdemux.c:1382:gst_flv_demux_parse_tag_video:<flvdemux0> parsing a video tag
gstflvdemux.c:1413:gst_flv_demux_parse_tag_video:<flvdemux0> dts bytes 00 81 F2 00 (33266)
gstflvdemux.c:1432:gst_flv_demux_parse_tag_video:<flvdemux0> got cts 0
gstflvdemux.c:1436:gst_flv_demux_parse_tag_video:<flvdemux0> video tag with codec tag 7, keyframe (1) (flags 17)
gstflvdemux.c:1521:gst_flv_demux_parse_tag_video:<flvdemux0> Nothing left in this tag, returning
I would highlight that this is marked as keyframe, but does not contain a NALU.
So it would seam that when the spec says "not requires or not supported" it actually means, MUST be implemented ;-P
So what the difference here is that ffmpeg produce an extra tag, with AVCPacketType 2 (sequence ender), which GStreamer does not add, because the spec says "lower level NALU sequence ender is not required or supported". So it seams we'll have to implement that, so Flash player does not go into infinit buffering face when reaching the end of the file. That's a really dummy bug in the flash player imho, as it knows it's the end since it has reached the end of the file. It looks to me as if code for fragmented or gapless FLV get triggered and that could explain the bug. Could easily be Flow Player bug, but we can't see the code.
Created attachment 305850 [details] [review]
flvmux: Insert AVC end of sequence
This FLV specific mark is needed to prevent Flow Player (most likely
all Flash base player) from going into buffering state when near EOS.
seems good! thanks
one last thing: If you try to play the flowplayer demo from this link (it is commented out in the sample html):
when the file end if you click on "play again" the play restart. With gstreamer generated files the play restart in firefox (old flash version) but not in chrome (new flash version). I don't know if this can be fixed gstreamer side too
Works for me on Flash player 17 (through pipelight on Firefox) and 18 (Chrome). Can you test against my file ?
Attachment 305850 [details] pushed as bbea34b - flvmux: Insert AVC end of sequence
(In reply to Nicolas Dufresne (stormer) from comment #6)
> Works for me on Flash player 17 (through pipelight on Firefox) and 18
> (Chrome). Can you test against my file ?
your file works, mime not, do you used the same pipeline I posted?
retested, even with your file does not restart every time in chrome (flash 18) while work every time in firefox (flash 11).
In chrome (really chromium + flash plugin from chrome) does not restart the second or the third time, I'll do more investigation if you are unable to reproduce,
I reproduced the problem even with flowplayer sample in chromium + flash 18, so nothing seems wrong now with flvmux
Ok, thanks a lot, I believe we've gone as far as we can for now.