Page 1 of 2

mpeg2encode licensing issue

Posted: 2008-08-07T11:24:22-07:00
by AdamW
Hi, there. I thought I'd reported this somewhere before but can't find any trace of it, so I'm doing it again. :)

ImageMagick relies on the 'mpeg2encode' tool for some MPEG video operations.

There's a problem here. mpeg2encode is not free / open source software. Its license terms - you can see them here: http://www.sfr-fresh.com/unix/misc/mpeg ... c/Makefile - don't explicitly address modification and redistribution, and you can't assume those rights if they're not explicitly granted. So it's not an F/OSS license.

This means that I, as a packager for Mandriva, cannot have mpeg2encode available for ImageMagick to use, so our ImageMagick package can't do the operations for which it relies on mpeg2encode.

It would be better if ImageMagick could switch to a free tool, like mpeg2enc from mjpegtools. Is there any possibility of this? Thanks.

Re: mpeg2encode licensing issue

Posted: 2008-08-07T11:51:53-07:00
by magick
We tried building the latest mjpegtools release, 1.9.0rc3, and we get a compile error:
  • In file included from macroblock.hh:53,
    from macroblock.cc:25:
    encodertypes.h: In member function 'int MotionVector::CodingPenaltyForSAD() const':
    encodertypes.h:73: error: 'abs' was not declared in this scope
    macroblock.cc: In member function 'void MacroBlock::SelectCodingModeOnVariance()':
    macroblock.cc:58: error: 'INT_MAX' was not declared in this scope
In addition, mpeg2enc does not appear to be available from livna. We hesitate to depend on unstable software or software that is not readily available.

We did add this issue to our TO-DO list but we currently do not have an ETA on when we will have a solution.

If someone wants to tackle this problem and post a patch, we will get it into a future release of ImageMagick.

Re: mpeg2encode licensing issue

Posted: 2008-08-07T11:56:03-07:00
by AdamW
One of these patches likely fixes it:

http://svn.mandriva.com/cgi-bin/viewvc. ... t/SOURCES/

mjpegtools is pretty widely available and used. I know mpeg2encode cannot be made available in Fedora because of the licensing issue (I've discussed this with Fedora's licensing guy, Tom Callaway).

Re: mpeg2encode licensing issue

Posted: 2008-08-07T15:57:47-07:00
by magick
These sorts of issues diminish our interest in mpeg2enc. It does not mean we won't use it, it just means we need to do additional research before we can bless it as a delegate in ImageMagick. Keep in mind that you could generate a patch specific to ImageMagick on Mandriva that uses mpep2enc until we get a blessed patch.

Re: mpeg2encode licensing issue

Posted: 2008-08-07T16:28:16-07:00
by AdamW
Yes, but I try to avoid distro-specific stuff and work with upstream wherever possible. That and I have to figure out how to crowbar it in and adjust the parameters accordingly. =)

Re: mpeg2encode licensing issue

Posted: 2008-08-08T11:37:40-07:00
by AdamW
See my comment on the Ubuntu bug on this issue here:

https://bugs.launchpad.net/ubuntu/+sour ... +bug/59908

I think I have a patch that will be good for decoding, but encoding is substantially trickier, as no usable modern encoder understands the .par file system that mpeg2encode uses, so it requires rather more substantial changes, and I am not a hacker at all.

BTW, the Google results for "mpeg2encode" and "mpeg2decode", if you look at them, will give you an idea of the extent of this issue - people from all sorts of distributions keep finding out that these applications are missing and so the ImageMagick functionality doesn't work.

Re: mpeg2encode licensing issue

Posted: 2008-08-08T12:45:54-07:00
by magick
A patch from you or another user is the best path to getting this into the ImageMagick source base as quickly as possible. We are in agreement with you but the ImageMagick developers are currently swamped and we will not get to this problem for a minimum of several months.

Re: mpeg2encode licensing issue

Posted: 2008-08-08T13:34:30-07:00
by AdamW
I can't get my patch attempt working. :\ Details in the Launchpad report.

For now I'll see if it's possible to centralize discussion of this issue here and in Launchpad - maybe if we can pull in the various places it's been discussed, we'll find someone who has the smarts to fix it.

Re: mpeg2encode licensing issue

Posted: 2008-08-08T14:37:21-07:00
by magick
We can get decoding working for you, its encoding that is a bit more problematic. Our question is if we use mpeg2enc for encoding should we not use mpeg2dec for decoding? Or is ffmpeg a better choice?

Re: mpeg2encode licensing issue

Posted: 2008-08-08T14:48:27-07:00
by AdamW
Well, first point, they're not actually related: mpeg2dec is part of libmpeg2 - http://libmpeg2.sourceforge.net/ - while mpeg2enc is part of mjpegtools . Actually completely separate projects.

But aside from that, yeah, mpeg2dec would be the logical choice (smaller and I think fewer deps than ffmpeg) - only it doesn't actually seem possible to get it to do what we want. As far as I can see it's hard coded to output files simply in the current directory, with sequential numerical names, and it only seems to do pgm , not ppm. So I figured it's not a workable option. But if it is - if one of the other output formats works and you can work with the filenames - then yes, it would probably be the sensible choice.

Re: mpeg2encode licensing issue

Posted: 2008-08-08T15:10:48-07:00
by magick
Ok, we'll add ffmpeg support to ImageMagick this evening. We'll defer support for mpeg2enc to a later date. One of the reasons for sticking with mpeg2decode and mpeg2encode is that they both work under Windows and they are lightweight. We'll need to do a conditional compile for MPEG for Linux vs. Windows.

Re: mpeg2encode licensing issue

Posted: 2008-08-08T15:17:46-07:00
by AdamW
Thanks a lot for that.

Re: mpeg2encode licensing issue

Posted: 2008-08-08T15:39:40-07:00
by magick
Ok, got it working. Confirm that ffmpeg is your final decision (as the best MPEG decoder). If so, we'll get the patch into the ImageMagick subversion trunk in about 2 hours.

Re: mpeg2encode licensing issue

Posted: 2008-08-08T20:31:51-07:00
by AdamW
I can't think of anything better. The only other obvious thing that comes to mind is transcode, but at least on MDV, transcode's deps are rather heavier than ffmpeg's. I think ffmpeg is the best option. So if anyone else disagrees, speak now or forever hold your peace =)

Re: mpeg2encode licensing issue

Posted: 2008-08-08T21:55:26-07:00
by magick
Ok, done. The patch is in the subversion trunk and will be available as ImageMagick 6.4.2-8 Beta sometime tomorrow.