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 330634 - Wrap the ffmpeg demuxers
Wrap the ffmpeg demuxers
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-libav
0.10.0
Other All
: Normal enhancement
: 0.10.1
Assigned To: GStreamer Maintainers
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-02-10 09:02 UTC by Peter Eszlari
Modified: 2006-02-15 18:52 UTC
See Also:
GNOME target: ---
GNOME version: ---



Description Peter Eszlari 2006-02-10 09:02:14 UTC
There seems to be no FLV demuxer in GStreamer 0.10 at the moment.

There could be workaround if you would add flash video (the codec) support to the matroska demuxer. The FLV demuxer in mplayer/ffmpeg doesn't support seeking with the examples given above. So I muxed them with ffmpeg from .flv-->.avi and then from .avi-->.mkv with "mkvmerge" (and fixed sync with it). They play fine in mplayer but gstreamer ignores the video, just plays the audio stream (MP3).



You can find a lot of flash videos on www.youtube.com, e.g.:

Embedded: http://www.youtube.com/w/nofx-live?v=7884Tl3lyoU
for downloading type:
wget -O test.flv http://www.youtube.com/get_video.php?video_id=7884Tl3lyoU
ffmpeg -i test.flv -vcodec copy -acodec copy test.avi
mkvmerge -o test.mkv --sync 1:100 test.avi
mplayer test.mkv


This, of course, would just be a workaround. A native FLV demuxer would be better.
Comment 1 Edward Hervey 2006-02-10 10:25:41 UTC
We haven't wrapped the ffmpeg demuxers in gst-ffmpeg 0.10.x . I guess that would be a start.

As for flv video, the encoder/decoder seems to be wrapped... but it has a bogus mimetype (video/x-gst_ff-flv) because we haven't got round to deciding on a gstreamer mimetype for flash video.

SO what needs to be done is:
1. Decide on a mimetype for the flv container format AND the flv video stream
2. Add a typefind function for flv container format
3. Wrap the ffmpeg demuxers in gst-ffmpeg
4. implement the proper mimetypes in gst-ffmpeg (ffmpegcodecmap.[ch])
5. implement the proper mimetypes in all muxers and demuxers (with proper fourcc <==> mimetype conversion functions)

Easy to do (or done):
1. the mimetype for flv container format is video/x-flv and is already implemented in gst-ffmpeg. As for the flv video stream, there isn't a known mimetype for it (which makes sense since it's a format which needs to be packetized). I'd go for "video/x-flash-video,flvversion=1", the version is because there might be a new format at one point (see [1]).
2. Should be rather easy. See "File Type Signifiers" in [1]
4. CODEC_ID_FLV1 <==> "video/x-flash-video,flvversion=1"
5.
For avi it should be implement in the riff library (gst-plugins-base/gst-libs/gst/riff/) using the "FLV1" fourcc.
For matroska, it uses the riff library too, since there's no specific codec id defined for FLV and therefore uses the V_MS/VFW/FOURCC codecic (see [2])
I don't see any other (de)muxer that needs that...

[1] http://www.digitalpreservation.gov/formats/fdd/fdd000131.shtml
[2] http://www.matroska.org/technical/specs/codecid/index.html
Comment 2 Edward Hervey 2006-02-10 11:00:07 UTC
Step 1, 4, 5 done and in cvs. I managed to play the test.mkv perfectly fine with seeking and such.
The test.avi is completely borked though (doesn't even work with mplayer).

BTW, that video is quite nice :)

2006-02-10  Edward Hervey  <edward@fluendo.com>

	* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps),
	(gst_riff_create_video_template_caps):
	Added FLV1 <==> 'video/x-flash-video,flvversion=1' conversion.
	Also added the caps to the default set of riff video caps.

2006-02-10  Edward Hervey  <edward@fluendo.com>

	* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_codecid_to_caps):
	added CODEC_ID_FLV1 <==> 'video/x-flash-video,flvversion=1' conversion.

Comment 3 Edward Hervey 2006-02-10 11:34:57 UTC
Step 2 is also done now. So the only thing left is wrapping the (de)muxers in gst-ffmpeg.
I'm modifying the title of the bug to reflect that.

2006-02-10  Edward Hervey  <edward@fluendo.com>

	* gst/typefind/gsttypefindfunctions.c: (plugin_init):
	Added flv file typefind (video/x-flv).
Comment 4 Edward Hervey 2006-02-10 19:46:28 UTC
Well the demuxers are in :) Changing title to reflect what's left.

2006-02-10  Edward Hervey  <edward@fluendo.com>

	* ext/ffmpeg/Makefile.am:
	* ext/ffmpeg/gstffmpeg.c: (plugin_init):
	* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_base_init),
	(gst_ffmpegdemux_init), (gst_ffmpegdemux_stream_from_pad),
	(gst_ffmpegdemux_handle_seek), (gst_ffmpegdemux_src_event),
	(gst_ffmpegdemux_src_query_list), (gst_ffmpegdemux_src_query),
	(gst_ffmpegdemux_add), (gst_ffmpegdemux_open),
	(gst_ffmpegdemux_loop), (gst_ffmpegdemux_sink_activate),
	(gst_ffmpegdemux_sink_activate_pull),
	(gst_ffmpegdemux_change_state), (gst_ffmpegdemux_register):
	* ext/ffmpeg/gstffmpegprotocol.c: (gst_ffmpegdata_open),
	(gst_ffmpegdata_peek), (gst_ffmpegdata_read),
	(gst_ffmpegdata_write), (gst_ffmpegdata_seek),
	(gst_ffmpegdata_close):
	Welcome the demuxers to 0.10 :)
	For the time being the demuxers work only pull-based.
	Seeking, querying works.

Comment 5 Edward Hervey 2006-02-10 20:15:42 UTC
Reverting title and closing in fact.
Comment 6 Peter Eszlari 2006-02-14 02:21:35 UTC
It's not working here (gst-ffmpeg cvs). Maybe I'm doing something wrong:


gst-launch-0.10 filesrc location=test.flv ! ffdemux_flv ! ffdec_flv ! xvimagesink

gst-launch-0.10 filesrc location=test.flv ! ffdemux_flv ! mad ! alsasink

gst-launch-0.10 filesrc location=test.mkv ! matroskademux ! ffdec_flv ! xvimagesink
Comment 7 Edward Hervey 2006-02-14 06:33:25 UTC
can you paste the results of those command with the following arguments inserted : gst-launch-0.10 -v -t filesrc ....
Comment 8 Peter Eszlari 2006-02-14 16:31:12 UTC
$ gst-launch-0.10 -v -t filesrc location=test.flv ! ffdemux_flv ! ffdec_flv ! xvimagesink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
FOUND TAG      : found by element "ffdemux_flv0".
    audio codec: MPEG-1 layer 3 audio
FOUND TAG      : found by element "ffdemux_flv0".
    video codec: FLV video


$ gst-launch-0.10 -v -t filesrc location=test.flv ! ffdemux_flv ! mad ! alsasink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
FOUND TAG      : found by element "ffdemux_flv0".
    audio codec: MPEG-1 layer 3 audio
FOUND TAG      : found by element "ffdemux_flv0".
    video codec: FLV video
/pipeline0/mad0.sink: caps = audio/mpeg, rate=(int)22050, channels=(int)1, mpegversion=(int)1, layer=(int)3


$ gst-launch-0.10 -v -t filesrc location=test.mkv ! matroskademux ! ffdec_flv ! xvimagesink
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
FOUND TAG      : found by element "matroskademux0".
  language code: und
FOUND TAG      : found by element "matroskademux0".
    audio codec: MPEG-1 layer 3
  language code: und
Comment 9 Edward Hervey 2006-02-14 17:17:41 UTC
I found the problem, could you try again with latest cvs of gst-ffmpeg ?

2006-02-14  Edward Hervey  <edward@fluendo.com>

	* ext/ffmpeg/gstffmpegdemux.c: (gst_ffmpegdemux_open):
	If the duration returned by ffmpeg is 0, it doesn't mean the file has
	no duration, but that it doesn't know the end.
	Fixed accordingly for segment_stop.

Comment 10 Peter Eszlari 2006-02-14 18:12:41 UTC
Weird, playing test.flv with totem works, although without seeking and it crashes around 2:10. But playing it through gst-launch still doesn't work.

Playing test.mkv with totem results in audio playback only.
Comment 11 Peter Eszlari 2006-02-15 18:52:12 UTC
I updated EVERYTHING to latest CVS and now flash in matroska works perfectly.
Good work!

Things left:
- test.flv crashes at 2:21
- no seeking in test.flv
- playing test.flv through gst-launch doesn't work