Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

hlsMuxer crashes when using h264_v4l2m2m encoder on Raspberry PI 4 #1155

Closed
1 of 13 tasks
georgy-komarov opened this issue Sep 15, 2022 · 3 comments
Closed
1 of 13 tasks
Labels
bug Something isn't working

Comments

@georgy-komarov
Copy link

Which version are you using?

v0.20.0

Which operating system are you using?

  • Linux amd64 standard
  • Linux amd64 Docker
  • Linux arm64 standard
  • Linux arm64 Docker
  • Linux arm7 standard
  • Linux arm7 Docker
  • Linux arm6 standard
  • Linux arm6 Docker
  • Windows amd64 standard
  • Windows amd64 Docker (WSL backend)
  • macOS amd64 standard
  • macOS amd64 Docker
  • Other (please describe)

Describe the issue

I'm trying to stream USB Webcam video as LL-HLS and using hardware h264 encoding on Raspberry Pi 4 (Raspbian arm64) with h264_v4l2m2m. However rtsp-simple-server crashes in 1-2 seconds after ffmpeg start.

However I'm not sure if it is ffmpeg issue or rtsp-simple-server issue because everything looks fine if I run the following commands

ffmpeg -f v4l2 -video_size 640x480 -framerate 24 -i /dev/video0 -c:v h264_v4l2m2m -an crash.mp4
ffmpeg -re -stream_loop -1 -i crash.mp4 -c copy -f rtsp rtsp://localhost:8554/cam

Describe how to replicate the issue

  1. Start the server
  2. Publish with ffmpeg -f v4l2 -video_size 640x480 -framerate 24 -i /dev/video0 -c:v h264_v4l2m2m -an -f rtsp rtsp://localhost:8554/cam

Did you attach the server logs?

yes
crash.log

Did you attach a network dump?

no

@aler9 aler9 mentioned this issue Dec 9, 2022
13 tasks
@aler9 aler9 added the bug Something isn't working label Dec 9, 2022
@aler9
Copy link
Member

aler9 commented Jan 4, 2023

Hello, this issue is caused by two bugs:

  1. a FFmpeg-side bug: when using h264_v4l2m2m, the SPS and PPS are not sent to the server. This has been fixed in FFmpeg 5 as reported by @roger- . FFmpeg 5 can be downloaded here

  2. a server-side bug: when SPS and PPS are not present, two empty NALUs are prepended to any IDR NALU, resulting in the crash

@aler9 aler9 mentioned this issue Jan 4, 2023
12 tasks
aler9 added a commit that referenced this issue Jan 5, 2023
in H264 and H264, parameters (VPS, SPS and PPS) are automatically
prepended to random access units. When parameters were nil, they were
prepended anyway, leading to a crash. Parameters are not prepended only
if they are valid.
@aler9
Copy link
Member

aler9 commented Jan 8, 2023

Fixed in v0.21.1

@aler9 aler9 closed this as completed Jan 8, 2023
@github-actions
Copy link
Contributor

This issue is being locked automatically because it has been closed for more than 6 months.
Please open a new issue in case you encounter a similar problem.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 14, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants