Login  Register

Re: FFmpeg plugin question

Posted by Stein Rørvik on Mar 02, 2019; 12:27pm
URL: http://imagej.273.s1.nabble.com/FFmpeg-plugin-question-tp5021858p5021867.html

Thanks;

I do not plan to do much work on this as I am not a programmer, I just research possible existing solutions. Sometimes one can make such a plugin export in a different format by just changing the name of the codec, since it is ffmpeg that does the conversion. My java programming skills is limited to changing existing code once I understand how it works, not writing anything complex from scratch.

So far I have found three plugins / libraries capable of exporting movies via ffmpeg from ImageJ, but none of them work correctly for H.264. Most work fine with MPEG4 but I have not yet found any that produces H.264 correctly. So today I convert on the command line. From that I see that H.264 gives the best quality video for my data, with MPEG4 second best. MPEG2 and MPEG1 gives inferior quality; all when comparing at the same bitrate.

Looking at the source code at the link you provided, I see that the codec is auto-determined by the library from the chosen file extension. The default is .mpg which gives a mpeg1video codec. So I tried to just change the output file extension to .mp4, and then I get a video file with an mpeg4 codec, which is much better. Unfortunately changing to .mkv did not result in any H.264 codec (which is usually the default for this container) but an mpeg4 codec too. Anyway, going from mpeg1 to mpeg4 is a big improvement, and the simple way to do this (just changing the output file extension) was not obvious to me until I saw the source code.

Stein

-----Original Message-----
From: ImageJ Interest Group <[hidden email]> On Behalf Of Curtis Rueden
Sent: 1. mars 2019 21:55
To: [hidden email]
Subject: Re: FFmpeg plugin question

Hi Stein,

The code for the FFMPEG update site can be found here:
  https://github.com/scifio/scifio-javacv/tree/ffmpeg

Development moved on from there a lot in that repository. If I recall recorrectly, Johannes's goal was to implement a SCIFIO Format plugin based on JavaCV, instead of using FFMPEG native libraries. But it never reached a releasable state.

The native FFMPEG libraries were built in a pretty crazy way by making system calls to configure and make via Java (!), which you can see from the source at that tag. I would not recommend trying to hack on the code from that point, but rather from the master branch, which leans on the javacv library for the FFMPEG native interface.

Happy to advise further if you decide to seriously work on this. Although you may want to post on forum.image.sc in the Development category rather than on this mailing list, in that case.

Regards,
Curtis

--
Curtis Rueden
LOCI software architect - https://loci.wisc.edu/software
ImageJ2 lead, Fiji maintainer - https://imagej.net/User:Rueden Have you tried the Image.sc Forum? https://forum.image.sc/



On Fri, Mar 1, 2019 at 12:53 PM Stein Rørvik <[hidden email]> wrote:

> The Fiji update site for FFMPEG links to
> http://fiji.sc/~schindelin/ffmpeg-plugins/
> This plugin works as advertised.
>
> But where can I find the source code of this ImageJ plugin (FFMPEG_IO.jar)?
> What I would like to do is to is to see if it can be modified to
> support modern codecs like H.264
>
> Under
> http://fiji.sc/~schindelin/ffmpeg-plugins/lib/
> we find the library files for the respective platforms, but they are a
> bit outdated (2013).
> Where can I find newer versions of the native libraries (ffmpeg.dll
> for
> Windows) ?
>
> Stein
>
> --
> ImageJ mailing list: http://imagej.nih.gov/ij/list.html
>

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html

--
ImageJ mailing list: http://imagej.nih.gov/ij/list.html