[MPlayer-users] MJPEG Streams on MacOS, Linux, Windows

Kevan Hashemi hashemi at opensourceinstruments.com
Tue May 14 21:55:11 EEST 2019

Dear Reimar,

Thank you for your help.

> But the "-f mpeg" to FFmpeg and MJPEG codec... Are you putting MJPEG 
> into a MPEG container?

It's the Raspberry Pi that's producing the stream, and calls is MJPEG. When I receive with ffmpeg and copy the stream codec into a file, ffmpeg says the file is "Video: mjpeg (mp4v / 0x7634706D), yuvj420p(pc, bt470bg/unknown/unknown)" Is there a container involved in the stream? I don't know.

> Either is quite a horrible format.

When your choice is H264 or MJPEG, these being the camera options, MJPEG does have certain advantages: every frame is a key frame, and arrives within one frame period of being captured by the image sensor. We synchronize video recordings with wireless EEG recordings to within fifty milliseconds.

> I would most strongly recommend to pick some other format (e.g. mkv, 
> nut or such)

I'm not using a container, so far as I know. I'm directing an incoming stream to MPlayer. If that incoming stream has a container, I have no control over it.

> specifying -demuxer lavf and maybe even -lavdopts format=mpeg

The first one works on MacOS MPlayer. The stream starts right away. The second one I believe is an mencoder option.

> As far as I know, basically all MPlayer versions will fail to 
> properly auto-detect that and hang randomly, and what you are seeing 
> is probably some versions handling it better than others.

I think you're right. The MPlayer versions that could figure it out took about ten seconds to do so. With "-demuxer" lavf they hook up and start streaming right away. I'm still getting this report from Linux MPlayer when I try to play the same stream:

Playing ffmpeg://tcp://
libavformat version 53.32.100 (external)
Using network protocols without global network initialization. Please use avformat_network_init(), this will become mandatory later.
Cache fill:  4.00% (40960 bytes)
Exiting... (End of file)

Best, Kevan

Kevan Hashemi, President
Open Source Instruments Inc.

More information about the MPlayer-users mailing list