change h264 to MJPEG #2653

Open
opened 2026-02-28 01:16:48 -05:00 by deekerman · 1 comment
Owner

Originally created by @erwinberlin on GitHub (Oct 5, 2025).

I have motioneye running on dietpi, and all runs well. However, I notice that the stream is encoded in h264 and I would like to have it in MJPEG.

so I tied a bit.. ffmpeg -f v4l2 -vcodec mjpeg -i /dev/video0 , with this result

  built with gcc 14 (Raspbian 14.2.0-19+rpi1)
  configuration: --prefix=/usr --extra-version='1~+rpt1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --disable-libmfx --disable-mmal --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --disable-libvpl --enable-neon --enable-v4l2-request --enable-libudev --enable-epoxy --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-vout-drm --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libcaca --enable-libdvdnav --enable-libdvdread --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sand --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared --libdir=/usr/lib/arm-linux-gnueabihf --cpu=arm1176jzf-s --arch=arm
  libavutil      59. 39.100 / 59. 39.100
  libavcodec     61. 19.101 / 61. 19.101
  libavformat    61.  7.100 / 61.  7.100
  libavdevice    61.  3.100 / 61.  3.100
  libavfilter    10.  4.100 / 10.  4.100
  libswscale      8.  3.100 /  8.  3.100
  libswresample   5.  3.100 /  5.  3.100
  libpostproc    58.  3.100 / 58.  3.100
Input #0, video4linux2,v4l2, from '/dev/video0':
  Duration: N/A, start: 631.635597, bitrate: N/A
  Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 640x480, 2 fps, 2 tbr, 1000k tbn
**At least one output file must be specified
[video4linux2,v4l2 @ 0x213e950] Some buffers are still owned by the caller on close.
ioctl(VIDIOC_QBUF): Bad file descriptor**

How can I change the streaming format?

Thanks!

Originally created by @erwinberlin on GitHub (Oct 5, 2025). I have motioneye running on dietpi, and all runs well. However, I notice that the stream is encoded in h264 and I would like to have it in MJPEG. so I tied a bit.. `ffmpeg -f v4l2 -vcodec mjpeg -i /dev/video0` , with this result ``` built with gcc 14 (Raspbian 14.2.0-19+rpi1) configuration: --prefix=/usr --extra-version='1~+rpt1' --toolchain=hardened --incdir=/usr/include/arm-linux-gnueabihf --enable-gpl --disable-stripping --disable-libmfx --disable-mmal --disable-omx --enable-gnutls --enable-libaom --enable-libass --enable-libbs2b --enable-libcdio --enable-libcodec2 --enable-libdav1d --enable-libflite --enable-libfontconfig --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgme --enable-libgsm --enable-libharfbuzz --enable-libmp3lame --enable-libmysofa --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-librubberband --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libtwolame --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx265 --enable-libxml2 --enable-libxvid --enable-libzimg --enable-openal --enable-opencl --enable-opengl --disable-sndio --disable-libvpl --enable-neon --enable-v4l2-request --enable-libudev --enable-epoxy --enable-libdc1394 --enable-libdrm --enable-libiec61883 --enable-vout-drm --enable-chromaprint --enable-frei0r --enable-ladspa --enable-libbluray --enable-libcaca --enable-libdvdnav --enable-libdvdread --enable-libjack --enable-libpulse --enable-librabbitmq --enable-librist --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libx264 --enable-libzmq --enable-libzvbi --enable-lv2 --enable-sand --enable-sdl2 --enable-libplacebo --enable-librav1e --enable-pocketsphinx --enable-librsvg --enable-libjxl --enable-shared --libdir=/usr/lib/arm-linux-gnueabihf --cpu=arm1176jzf-s --arch=arm libavutil 59. 39.100 / 59. 39.100 libavcodec 61. 19.101 / 61. 19.101 libavformat 61. 7.100 / 61. 7.100 libavdevice 61. 3.100 / 61. 3.100 libavfilter 10. 4.100 / 10. 4.100 libswscale 8. 3.100 / 8. 3.100 libswresample 5. 3.100 / 5. 3.100 libpostproc 58. 3.100 / 58. 3.100 Input #0, video4linux2,v4l2, from '/dev/video0': Duration: N/A, start: 631.635597, bitrate: N/A Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 640x480, 2 fps, 2 tbr, 1000k tbn **At least one output file must be specified [video4linux2,v4l2 @ 0x213e950] Some buffers are still owned by the caller on close. ioctl(VIDIOC_QBUF): Bad file descriptor** ``` How can I change the streaming format? Thanks!
Author
Owner

@MichaIng commented on GitHub (Feb 8, 2026):

Which stream do you mean?

  • The camera stream emitted by motion is indeed in MJPEG format already, and this cannot be changed: https://motion-project.github.io/motion_config.html#OptDetail_Stream
  • For recordings, the format can be selected, but MJPEG is not an option, and I am not sure whether there is a container file format to provide a video file from JPEG images 😄?
@MichaIng commented on GitHub (Feb 8, 2026): Which stream do you mean? - The camera stream emitted by `motion` is indeed in MJPEG format already, and this cannot be changed: https://motion-project.github.io/motion_config.html#OptDetail_Stream - For recordings, the format can be selected, but MJPEG is not an option, and I am not sure whether there is a container file format to provide a video file from JPEG images 😄?
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/motioneye#2653
No description provided.