Problems with running mjpeg video files

Dear Han,
Our team is using ELAN for a linguistic project which deals with mjpeg avi files (frame frequency 100fps). We have faced several particular problems while working with this type of files in ELAN:

  1. On some computers ELAN cannot open more than one media mjpeg file, it crashes down immediately. However on other computers (both on Windows and on Mac OS) it opens them correctly. We have tried out different options and media players (Quick Time player/ Jave media framework) but still have not found any possible correlation.
  2. Sometimes ELAN does not run several media files correctly if one of them contains an mjpeg codec and the other is an ordinary .mp4. For example, it could suddenly stop running both of them and display the well-known message “Java™ Platform SE Binary has stopped working”.

One of our colleagues recommended us to do the following steps to solve these problems - 1) install Haali Media Splitter and Gabest MPEG Video Decoder; 2) select Edit > Preferences > Edit Preferences > Platform/OS > Java DirectShow Framework; 3) install Java Media Framework and select Edit > Preferences > Edit Preferences > Platform/OS > Java Media Framework. Unfortunately his recommendations were originally given for MPEG files with inner compression and maybe here is the reason why they did not work for mjpeg avi files on all our computers. Confusingly, Quick Time player (option Quick Time for Java) seems to be even more appropriate for playing several mjpeg files so far (it does not cause a crash of the whole program as much as Jave Media Framework does). And also on Windows PCs we have not found an option to change the aspect ratio of the video - it is displayed on the menu only if we use Quick Time and not Jave Media Framework :frowning:

That is why we decided to contact you and ask you about any particular recommendations on working with mjpeg avi files in ELAN. Could there be any different sets of rules on how to run several media files correctly that depend on the video codec? Maybe you could give us any particular advice on how to work with mjpeg in ELAN in general?

Many thanks to you in advance!

I’m afraid I have no immediate recommendations for these problems; I don’t think I have ever had mjpeg avi files around to do any testing with.

First of all I would like to know which (ELAN) media players are playing the files on the computers where play back (of 1 file) works. I’m referring to the information that is shown after selecting “Player Info” in the context menu of a video.
Separating the Windows and MacOS problems:

Windows: I would expect Java Direct Show as the default (if nothing else has been specified in the Preferences). If that is the case it would be interesting to see the Filter Graph (from the context menu). If these parts of information have not been taken into account yet in the comparison between PC’s that crash and those that don’t, it might be good to do so.
I probably understand the recommendations of your colleague, at least step 1 and 2. But on Windows Java Media Framework is still part of the ELAN distribution so you wouldn’t need to install that (and in general I wouldn’t expect this framework to be the solution, but one never knows).
After a crash are there any “xx_pid_nnnn.log” files in the ELAN install folder?

MacOS: normally I tend to assume that the “CocoaQT” player is the only viable option on this platform. But avi files are not (always) supported on this platform, so it would be interesting to know how the files are played on MacOS systems where your files work.

I don’t suppose there are relevant messages in the ELAN log after a hard crash (elan0.log etc. in ELAN’s data and preferences folder)?

-Han

Dear Han,

thank you for your answer. Probably I should clarify you our choice of mjpeg media files: we are doing an interdisciplinary research on language as a multichannel process that include verbal, vocal, manual components, facial expressions and eye movements. The crucial point for us is to fix all these data correctly for a proficient and real-communication-oriented study. Unfortunately .mp4 and most other video formats are based on the principle of key frames - and other frames are displayed with slight changes and/or in a slightly different way due to the computer. We cannot allow such losses in our study and so we have opted for mjpeg format that does not distinguish key frames from the others and so reflects all data correctly.

Here is a demo fragment from one of our ELAN sets that includes 3 mjpeg avi files (about 1-minute-length). http://www.multidiscourse.ru/annotation/ We would be really grateful if you could test them together somehow. Particularly, we are trying to resolve the issue of pre-installing special codecs to work exactly with mjpeg because the incorrect playback perhaps is due to our non-standard format too. If you could test our files, maybe you could help us with this question? Would it be reasonable to install the pvm codecs https://www.accusoft.com/products/picvideo-m-jpeg-codec/overview/ before launching our work in ELAN with mjpeg ? Or some other codecs?

As for players, on MacOS we have found that CocoaQT indeed does not play all our files properly but Quick Time player does. Practically the same we have on Windows (on those computers where Quick Time works as such because sometimes it comes into conflict with some Windows features and closes down too :(. Particularly, on most of our Windows computers (but not on all ones however) we have come to the following steps for a better playback:

  1. Remove ELAN
  2. Install Quick Time for Java (select the following option in Quick Time package)
  3. Restart the computer and re-install ELAN
  4. Select the option “Quick Time for Java” in ELAN (unfortunately Java Media Framework often causes a crash for reasons not yet known).

Could you helps us with the question why such an unconventional strategy is the only one that works (and sometimes even it does not work on Windows either)? And how do our previously discussed recommendations about Haali Media Splitter and Gabest MPEG Video Decoder come along with it?

Thank you a lot in advance!

Evgeniya

Dear Evgeniya,

Thank you for the background information, I think I understand your considerations. Unfortunately I’m not a specialist in mjpeg or media encoding in general and I can’t advise on the pvm codecs you mention. I’ll ask some colleagues to have a look as well.
One suggestion that will surely be put forward is that of key-frame-only mp4. Did you consider that option, or even try it? In principle that seems to work quite well (but I’m not sure if we tested it with 3 large files).

I could play your example files both on Windows (JDS Player) and on macOS (Cocoa QT Player). No crashes so far, but these were only short tests.

In general: I don’t think I can get the Quick Time for Java player to work in ELAN on macOS just like that. It is possible to select it in the preferences but it will give an error once ELAN tries to create an instance of that player.
On Windows the QuickTime for Java player is “deprecated”; Apple no longer supports it and even advises to uninstall it. So I think it would be bad to depend on that player for a project and the same for the very old Java Media Framework.
There should be a better solution than this…

Hi Evgeniya,

Another solution you could consider is creating I-frame (or intra-frame) mpeg2 files. Essentially, they would be identical to mjpeg, but probably a bit smaller in file-size.
Information on how to create these (and how to create I-frame mp4 files) can be found here:

https://tla.mpi.nl/wp-content/uploads/2016/12/Video_encoding_guidelines_ELAN.pdf

Best,
Jeroen