[GH-ISSUE #61] Mjpeg stops after 5 seconds #50

Open
opened 2026-03-02 04:09:02 +03:00 by kerem · 6 comments
Owner

Originally created by @MorsMortium on GitHub (Feb 19, 2026).
Original GitHub issue: https://github.com/gen2brain/cam2ip/issues/61

It does not happen on the html link. Tested with 3 separate webcams.
The frame looks like it stopped rendering at one point and has a white bar on the bottom.
This is the error message that it outputs:

2026/02/19 15:52:28 mjpeg: encode: write tcp 127.0.0.1:56000->127.0.0.1:54138: i/o timeout

After a refresh it does work again, but in my case the mjpeg stream is imported into Home Assistant, which does not refresh and the video stops until reconfigured/restarted.

Originally created by @MorsMortium on GitHub (Feb 19, 2026). Original GitHub issue: https://github.com/gen2brain/cam2ip/issues/61 It does not happen on the html link. Tested with 3 separate webcams. The frame looks like it stopped rendering at one point and has a white bar on the bottom. This is the error message that it outputs: ``` 2026/02/19 15:52:28 mjpeg: encode: write tcp 127.0.0.1:56000->127.0.0.1:54138: i/o timeout ``` After a refresh it does work again, but in my case the mjpeg stream is imported into Home Assistant, which does not refresh and the video stops until reconfigured/restarted.
Author
Owner

@MorsMortium commented on GitHub (Feb 22, 2026):

As it turns out, this is not related to movement, but happens after 5 seconds

<!-- gh-comment-id:3940011864 --> @MorsMortium commented on GitHub (Feb 22, 2026): As it turns out, this is not related to movement, but happens after 5 seconds
Author
Owner

@gen2brain commented on GitHub (Feb 26, 2026):

What OS are you using, i.e., what cam driver? Can you test with ffplay -i http://localhost:56000/mjpeg? Does the same thing happen? Do you use old binaries from releases, or did you build the binary?

<!-- gh-comment-id:3965251720 --> @gen2brain commented on GitHub (Feb 26, 2026): What OS are you using, i.e., what cam driver? Can you test with `ffplay -i http://localhost:56000/mjpeg`? Does the same thing happen? Do you use old binaries from releases, or did you build the binary?
Author
Owner

@MorsMortium commented on GitHub (Feb 26, 2026):

I use Artix (like Arch) linux.
ffplay only shows a single frame, not even from when it started, but when the video was last played.
Output:

ffplay version n8.0.1 Copyright (c) 2003-2025 the FFmpeg developers
  built with gcc 15.2.1 (GCC) 20260209
  configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libdvdnav --enable-libdvdread --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgsm --enable-libharfbuzz --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librsvg --enable-librubberband --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-vapoursynth --enable-version3 --enable-vulkan
  libavutil      60.  8.100 / 60.  8.100
  libavcodec     62. 11.100 / 62. 11.100
  libavformat    62.  3.100 / 62.  3.100
  libavdevice    62.  1.100 / 62.  1.100
  libavfilter    11.  4.100 / 11.  4.100
  libswscale      9.  1.100 /  9.  1.100
  libswresample   6.  1.100 /  6.  1.100
Input #0, mpjpeg, from 'http://localhost:56000/mjpeg':   0B 
  Duration: N/A, bitrate: N/A
  Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 640x480, 25 tbr, 25 tbn
[swscaler @ 0x7fc574102f40] deprecated pixel format used, make sure you did set range correctly
[mpjpeg @ 0x7fc5800009c0] Packet corrupt (stream = 0, dts = NOPTS).                                  
[mjpeg @ 0x7fc580005400] overread 8                                                                  
[mjpeg @ 0x7fc580005400] EOI missing, emulating                                                      
  10.53 M-V:  2.909 fd=   1 aq=    0KB vq=    0KB sq=    0B                                          

The Packet corrupt line happens at 5 seconds.
I used go install github.com/gen2brain/cam2ip/cmd/cam2ip@latest to install it

<!-- gh-comment-id:3965337303 --> @MorsMortium commented on GitHub (Feb 26, 2026): I use Artix (like Arch) linux. ffplay only shows a single frame, not even from when it started, but when the video was last played. Output: ``` ffplay version n8.0.1 Copyright (c) 2003-2025 the FFmpeg developers built with gcc 15.2.1 (GCC) 20260209 configuration: --prefix=/usr --disable-debug --disable-static --disable-stripping --enable-amf --enable-avisynth --enable-cuda-llvm --enable-lto --enable-fontconfig --enable-frei0r --enable-gmp --enable-gnutls --enable-gpl --enable-ladspa --enable-libaom --enable-libass --enable-libbluray --enable-libbs2b --enable-libdav1d --enable-libdrm --enable-libdvdnav --enable-libdvdread --enable-libfreetype --enable-libfribidi --enable-libglslang --enable-libgsm --enable-libharfbuzz --enable-libiec61883 --enable-libjack --enable-libjxl --enable-libmodplug --enable-libmp3lame --enable-libopencore_amrnb --enable-libopencore_amrwb --enable-libopenjpeg --enable-libopenmpt --enable-libopus --enable-libplacebo --enable-libpulse --enable-librav1e --enable-librsvg --enable-librubberband --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libsrt --enable-libssh --enable-libsvtav1 --enable-libtheora --enable-libv4l2 --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvpl --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxcb --enable-libxml2 --enable-libxvid --enable-libzimg --enable-libzmq --enable-nvdec --enable-nvenc --enable-opencl --enable-opengl --enable-shared --enable-vapoursynth --enable-version3 --enable-vulkan libavutil 60. 8.100 / 60. 8.100 libavcodec 62. 11.100 / 62. 11.100 libavformat 62. 3.100 / 62. 3.100 libavdevice 62. 1.100 / 62. 1.100 libavfilter 11. 4.100 / 11. 4.100 libswscale 9. 1.100 / 9. 1.100 libswresample 6. 1.100 / 6. 1.100 Input #0, mpjpeg, from 'http://localhost:56000/mjpeg': 0B Duration: N/A, bitrate: N/A Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 640x480, 25 tbr, 25 tbn [swscaler @ 0x7fc574102f40] deprecated pixel format used, make sure you did set range correctly [mpjpeg @ 0x7fc5800009c0] Packet corrupt (stream = 0, dts = NOPTS). [mjpeg @ 0x7fc580005400] overread 8 [mjpeg @ 0x7fc580005400] EOI missing, emulating 10.53 M-V: 2.909 fd= 1 aq= 0KB vq= 0KB sq= 0B ``` The Packet corrupt line happens at 5 seconds. I used `go install github.com/gen2brain/cam2ip/cmd/cam2ip@latest` to install it
Author
Owner

@gen2brain commented on GitHub (Feb 26, 2026):

Can you try @master? The latest release was many years ago.

<!-- gh-comment-id:3965362709 --> @gen2brain commented on GitHub (Feb 26, 2026): Can you try @master? The latest release was many years ago.
Author
Owner

@MorsMortium commented on GitHub (Feb 26, 2026):

Same happens, I have removed ~/go, ~/.config/go, ~/.cache/go-build and /.cache/go before installing, so that no files of the previous install remain

<!-- gh-comment-id:3965492313 --> @MorsMortium commented on GitHub (Feb 26, 2026): Same happens, I have removed ~/go, ~/.config/go, ~/.cache/go-build and /.cache/go before installing, so that no files of the previous install remain
Author
Owner

@gen2brain commented on GitHub (Feb 26, 2026):

I just tested with the old laptop with a camera, and I can reproduce this, the same issue. Not sure when I will have time to work and debug this, though. This is a project I occasionally work on.

<!-- gh-comment-id:3965775784 --> @gen2brain commented on GitHub (Feb 26, 2026): I just tested with the old laptop with a camera, and I can reproduce this, the same issue. Not sure when I will have time to work and debug this, though. This is a project I occasionally work on.
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/cam2ip#50
No description provided.