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 332339 - FFmpeg muxers port to 0.10
FFmpeg muxers port to 0.10
Status: RESOLVED FIXED
Product: GStreamer
Classification: Platform
Component: gst-libav
git master
Other Linux
: Normal enhancement
: 0.10.2
Assigned To: Edward Hervey
GStreamer Maintainers
Depends on:
Blocks:
 
 
Reported: 2006-02-23 15:23 UTC by Michal Benes
Modified: 2006-09-08 15:27 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Port of ffmuxers to 0.10 (22.41 KB, patch)
2006-02-23 15:24 UTC, Michal Benes
none Details | Review
Port of ffmuxers to 0.10 (22.28 KB, patch)
2006-03-01 15:37 UTC, Michal Benes
none Details | Review
Port of ffmuxers to 0.10 (22.06 KB, patch)
2006-03-01 16:18 UTC, Michal Benes
none Details | Review
fixed up version (24.69 KB, patch)
2006-03-01 17:03 UTC, Edward Hervey
none Details | Review
ffmux port gst 0.10 (18.72 KB, patch)
2006-09-08 14:40 UTC, Michal Benes
committed Details | Review

Description Michal Benes 2006-02-23 15:23:19 UTC
The attached patch enable ffmuxers in gst 0.10
Comment 1 Michal Benes 2006-02-23 15:24:13 UTC
Created attachment 60004 [details] [review]
Port of ffmuxers to 0.10
Comment 2 Michal Benes 2006-03-01 15:37:25 UTC
Created attachment 60410 [details] [review]
Port of ffmuxers to 0.10

This is updated patch against the latest CVS version
Comment 3 Edward Hervey 2006-03-01 16:02:23 UTC
I am currently patching it up a little bit before commit. Is there any  major modifications in the new patch ?
Comment 4 Michal Benes 2006-03-01 16:11:05 UTC
No, this new version only fixes conflict in gstffmpeg.c and Makefile.am made by the inclusion of ffscaler patch.
Beside, as I have just observed, this patch includes gstffmpegprotocol.c two times in libgstffmpeg_la_SOURCES what is wrong.
Comment 5 Michal Benes 2006-03-01 16:18:03 UTC
Created attachment 60411 [details] [review]
Port of ffmuxers to 0.10

Accidentaly broken Makefile.am in the last patch fixed.
Comment 6 Edward Hervey 2006-03-01 16:33:52 UTC
ok, I'm still going over some fixes. Once it's good I'll commit.
Comment 7 Edward Hervey 2006-03-01 16:59:45 UTC
Several comments:
set/get_property are not needed, nor are the signal/property enums.

Around line 500 (/* set time */) you're setting pkt.pts twice, which means only the second one will be taken into account. Is that an error ?
    pkt.pts = GST_BUFFER_TIMESTAMP (buf) * 9 / (GST_SECOND / 10000);
    pkt.pts = gst_ffmpeg_time_gst_to_ff (GST_BUFFER_TIMESTAMP (buf),

Comment 8 Edward Hervey 2006-03-01 17:03:31 UTC
Created attachment 60413 [details] [review]
fixed up version

Same as latest patch with fixes.
Comment 9 Michal Benes 2006-03-01 17:26:14 UTC
     /* set time */
+    pkt.pts = GST_BUFFER_TIMESTAMP (buf) * 9 / (GST_SECOND / 10000);
Hi,

the following code is from our hacked vesrion. I have included it accidentaly.
The packet timestamping code should not be changed. I am sorry about that

     pkt.pts = gst_ffmpeg_time_gst_to_ff (GST_BUFFER_TIMESTAMP (buf),
-        ffmpegmux->context->streams[bufnum]->time_base);
-    pkt.dts = pkt.pts;
+        ffmpegmux->context->streams[best_pad->padnum]->time_base);
+    if (GST_BUFFER_DATA (buf) != GST_BUFFER_MALLOCDATA (buf)) {
+        pkt.dts = *((GstClockTime *) GST_BUFFER_MALLOCDATA (buf))
+            * 9 / (GST_SECOND / 10000);
+    } else {
+        pkt.dts = pkt.pts;
+    }
+

Just leave
     pkt.pts = gst_ffmpeg_time_gst_to_ff (GST_BUFFER_TIMESTAMP (buf),
         ffmpegmux->context->streams[bufnum]->time_base);
     pkt.dts = pkt.pts;
in the code.
Comment 10 Edward Hervey 2006-03-01 17:41:36 UTC
still way too buggy to go in cvs.

I can't manage to get a simple transcoding pipeline to work and there's not enough error information.

Could you please provide an extensive list of pipelines on which it was tested and for which it works for you in order to figure out what's going wrong.
Comment 11 Michal Benes 2006-03-02 15:38:59 UTC
I have forgot one more thing in the patch:
It seems to me that setting time_base at the line 296 is wrong. Timebase should be  initialized by ffmpeg itself. 

I have tested the muxer by transcoding DVDs to mpeg-TS and mpeg-PS (also .vob format) using codecs h264/mpeg2audio and mpeg2video/mpeg2audio. The system was already deplayed to our customer and it works just fine.
Comment 12 Edward Hervey 2006-08-31 13:27:14 UTC
Michael, could you please submit a clean updated patch:
_ clean : no weird 'for-your-customer-only' modifications (like in comment #9)
_ updated : against current gst-ffmpeg cvs

btw, aren't you facing legal issues using these mpeg muxers for commercial reasons ?
Comment 13 Michal Benes 2006-09-08 14:40:25 UTC
Created attachment 72415 [details] [review]
ffmux port gst 0.10

This a new patch version. It has been created almost from scratch. I have tested mpeg, mpegts, flv, vob. I have tested with valgrind and found no obvious problems.
Comment 14 Michal Benes 2006-09-08 14:54:06 UTC
The following pipe works without problems

gst-launch -v --gst-debug-level=2 filesrc location=movie.mpeg ! decodebin name=d d. ! ffmpegcolorspace ! ffenc_mpeg2video ! queue ! m. d. ! audioconvert ! lame ! queue ! m. ffmux_mpeg name=m ! filesink location=transcoded.mpeg

[To Edward]: What legal issues do you mean? Do mean patent issues? I thougth that Europe is still patent-safe. FFmpeg is LGPL so there is no problem to use gst-fmpeg plugins in proprietary encoder and of course, we are releasing the sources. BTW: We do not use ffmpegmux anymore.
Comment 15 Edward Hervey 2006-09-08 15:10:53 UTC
(In reply to comment #14)
> The following pipe works without problems
> 
> gst-launch -v --gst-debug-level=2 filesrc location=movie.mpeg ! decodebin
> name=d d. ! ffmpegcolorspace ! ffenc_mpeg2video ! queue ! m. d. ! audioconvert
> ! lame ! queue ! m. ffmux_mpeg name=m ! filesink location=transcoded.mpeg
> 

  Excellent, will give it another try and if it doesn't need too much cleaning-up I'll commit it.

> [To Edward]: What legal issues do you mean? Do mean patent issues? I thougth
> that Europe is still patent-safe. FFmpeg is LGPL so there is no problem to use
> gst-fmpeg plugins in proprietary encoder and of course, we are releasing the
> sources. BTW: We do not use ffmpegmux anymore.
> 

  The code is LGPL, but distributing software that implements some patent-protected codecs still requires you to have a license if you want to distribute worldwide (I'm thinking mostly about the mpeg consortium/mp3 licenses). It's not at all sourcecode issue.
Comment 16 Michal Benes 2006-09-08 15:21:13 UTC
(In reply to comment #15)
>   Excellent, will give it another try and if it doesn't need too much
> cleaning-up I'll commit it.

Good, tell if you run into any sort of issue.

> > [To Edward]: What legal issues do you mean? Do mean patent issues? I thougth
> > that Europe is still patent-safe. FFmpeg is LGPL so there is no problem to use
> > gst-fmpeg plugins in proprietary encoder and of course, we are releasing the
> > sources. BTW: We do not use ffmpegmux anymore.
> > 
> 
>   The code is LGPL, but distributing software that implements some
> patent-protected codecs still requires you to have a license if you want to
> distribute worldwide (I'm thinking mostly about the mpeg consortium/mp3
> licenses). It's not at all sourcecode issue.

We are well aware about this and we are aware that some patent licences may be incompatible with (L)GPL. We are going to play the game according to the rules ;-)

Comment 17 Edward Hervey 2006-09-08 15:27:36 UTC
latest patch was much cleaner, it's now in cvs. There's still work to do though in gstffmpegcodecmap.c to put proper mappings of supported codecs for each container format.

2006-09-08  Edward Hervey  <edward@fluendo.com>

	Patch by: Michal Benes  <michal dot benes at xeris dot cz>
	
	* ext/ffmpeg/Makefile.am:
	* ext/ffmpeg/gstffmpeg.c: (plugin_init):
	* ext/ffmpeg/gstffmpegcodecmap.c: (gst_ffmpeg_caps_to_codecid):
	* ext/ffmpeg/gstffmpegmux.c: (gst_ffmpegmux_base_init),
	(gst_ffmpegmux_init), (gst_ffmpegmux_finalize),
	(gst_ffmpegmux_request_new_pad), (gst_ffmpegmux_setcaps),
	(gst_ffmpegmux_collected), (gst_ffmpegmux_change_state),
	(gst_ffmpegmux_register):
	Port of FFMpeg muxers to 0.10.
	Still needs some loving in gstffmpegcodecmap to have them all supported
	with correct input formats.
	Closes #332339