After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 751320 - flvmux: Does not append AVC end of sequence
flvmux: Does not append AVC end of sequence
Product: GStreamer
Classification: Platform
Component: gst-plugins-good
git master
Other Linux
: Normal normal
: 1.5.2
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Reported: 2015-06-22 12:38 UTC by Nicola
Modified: 2015-06-22 22:50 UTC
See Also:
GNOME target: ---
GNOME version: ---

flvmux: Insert AVC end of sequence (5.10 KB, patch)
2015-06-22 18:37 UTC, Nicolas Dufresne (ndufresne)
committed Details | Review

Description Nicola 2015-06-22 12:38:08 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
Comment 1 Nicolas Dufresne (ndufresne) 2015-06-22 14:29:14 UTC
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.
Comment 2 Nicolas Dufresne (ndufresne) 2015-06-22 17:16:40 UTC
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.
Comment 3 Nicolas Dufresne (ndufresne) 2015-06-22 18:37:43 UTC
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.
Comment 4 Nicola 2015-06-22 20:50:17 UTC
seems good! thanks
Comment 5 Nicola 2015-06-22 20:56:58 UTC
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
Comment 6 Nicolas Dufresne (ndufresne) 2015-06-22 21:11:07 UTC
Works for me on Flash player 17 (through pipelight on Firefox) and 18 (Chrome). Can you test against my file ?
Comment 7 Nicolas Dufresne (ndufresne) 2015-06-22 21:25:16 UTC
Attachment 305850 [details] pushed as bbea34b - flvmux: Insert AVC end of sequence
Comment 8 Nicola 2015-06-22 21:56:53 UTC
(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?
Comment 9 Nicola 2015-06-22 22:03:18 UTC
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,

Comment 10 Nicola 2015-06-22 22:21:25 UTC
I reproduced the problem even with flowplayer sample in chromium + flash 18, so nothing seems wrong now with flvmux
Comment 11 Nicolas Dufresne (ndufresne) 2015-06-22 22:50:15 UTC
Ok, thanks a lot, I believe we've gone as far as we can for now.