Closed spookyfirehorse closed 6 months ago
on 4.3.6 same error is there no solution ?
any help is welcome
new ffmpeg comand is
ffmpeg -hwaccel drm -hwaccel_output_format drm_prime -fflags +nobuffer -use_wallclock_as_timestamps 1 -avioflags direct -flags low_delay -probesize 320 -analyzeduration 32 -hide_banner \ -f alsa -i plughw:CARD=S3,DEV=0 -f v4l2 -input_format h264 -itsoffset 0.90 -f v4l2 -i /dev/video0 -vcodec h264_v4l2m2m -g 45 -b:v 1500k -acodec libfdk_aac -b:a 96k -map 1:0 -map 0:0 \ -threads 4 -f rtsp -rtsp_transport tcp rtsp://localhost:8554/mystream.sdp
mpv rtsp://localhost:8554/mystream.sdp
h264: non-existing PPS 0 referenced [ffmpeg/video] h264: decode_slice_header error [ffmpeg/video] h264: no frame!
searching for any solution
On the information given - dunno. Try outputting to a file rather than than rtsp so we can see what is coming out of ffmpeg?
ffmpeg -hwaccel drm -hwaccel_output_format drm_prime -fflags +nobuffer -use_wallclock_as_timestamps 1 -flags low_delay -probesize 32 -analyzeduration 0 -hide_banner -f alsa -thread_queue_size 256 -i plughw:CARD=Device,DEV=0 -f v4l2 -input_format h264 -itsoffset 0.30 -f v4l2 -i /dev/video0 -vcodec h264_v4l2m2m -b:v 1500k -acodec libfdk_aac -b:a 32k -map 1:0 -map 0:0 -threads 4 -f mp4 test.mp4
Guessed Channel Layout for Input Stream #0.0 : stereo
Input #0, alsa, from 'plughw:CARD=Device,DEV=0':
Duration: N/A, start: 1683118390.767611, bitrate: 1536 kb/s
Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Input #1, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 11220.883825, bitrate: N/A
Stream #1:0: Video: h264 (Main), yuv420p(progressive), 640x360, 25 fps, 25 tbr, 1000k tbn, 2000k tbc
File 'test.mp4' already exists. Overwrite? [y/N] y
Stream mapping:
Stream #1:0 -> #0:0 (h264 (native) -> h264 (h264_v4l2m2m))
Stream #0:0 -> #0:1 (pcm_s16le (native) -> aac (libfdk_aac))
Press [q] to stop, [?] for help
[alsa @ 0x1d8afc0] ALSA buffer xrun.
[video4linux2,v4l2 @ 0x1d9dd50] Thread message queue blocking; consider raising the thread_queue_size option (current value: 8)
[h264_v4l2m2m @ 0x1daec80] <<< v4l2_encode_init: fmt=0/-1
[h264_v4l2m2m @ 0x1daec80] Using device /dev/video11
[h264_v4l2m2m @ 0x1daec80] driver 'bcm2835-codec' on card 'bcm2835-codec-encode' in mplane mode
[h264_v4l2m2m @ 0x1daec80] requesting formats: output=YU12 capture=H264
Output #0, mp4, to 'test.mp4':
Metadata:
encoder : Lavf58.45.100
Stream #0:0: Video: h264 (h264_v4l2m2m) (avc1 / 0x31637661), yuv420p(progressive), 640x360, q=-1--1, 1500 kb/s, 25 fps, 12800 tbn, 25 tbc
Metadata:
encoder : Lavc58.91.100 h264_v4l2m2m
Stream #0:1: Audio: aac (libfdk_aac) (mp4a / 0x6134706D), 48000 Hz, stereo, s16, 32 kb/s
Metadata:
encoder : Lavc58.91.100 libfdk_aac
frame= 285 fps= 32 q=-0.0 Lsize= 1080kB time=00:00:11.40 bitrate= 775.4kbits/s dup=7 drop=0 speed=1.26x
video:1036kB audio:35kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.898392%
play the test file with mpv
mpv /media/moon/test.mp4 (+) Video --vid=1 () (h264 640x360 25.000fps) (+) Audio --aid=1 () (aac 2ch 48000Hz) Failed to open VDPAU backend libvdpau_vc4.so: cannot open shared object file: No such file or directory Using hardware decoding (v4l2m2m-copy). AO: [pipewire] 48000Hz stereo 2ch floatp VO: [gpu-next] 640x360 yuv420p AV: 00:00:02 / 00:00:11 (24%) A-V: 0.000
its running
when i do that with rtsp
ffmpeg -hwaccel drm -hwaccel_output_format drm_prime -fflags +nobuffer -use_wallclock_as_timestamps 1 -flags low_delay -probesize 32 -analyzeduration 0 -hide_banner \ -f alsa -thread_queue_size 256 -i plughw:CARD=Device,DEV=0 -f v4l2 -input_format h264 -itsoffset 0.30 -f v4l2 -i /dev/video0 -vcodec h264_v4l2m2m -b:v 1500k -acodec libfdk_aac -b:a 32k -map 1:0 -map 0:0 \ -threads 4 -f rtsp -rtsp_transport tcp rtsp://localhost:8556/mystream Guessed Channel Layout for Input Stream #0.0 : stereo Input #0, alsa, from 'plughw:CARD=Device,DEV=0': Duration: N/A, start: 1683118620.854253, bitrate: 1536 kb/s Stream #0:0: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s Input #1, video4linux2,v4l2, from '/dev/video0': Duration: N/A, start: 11450.977450, bitrate: N/A Stream #1:0: Video: h264 (Main), yuv420p(progressive), 640x360, 25 fps, 25 tbr, 1000k tbn, 2000k tbc Stream mapping: Stream #1:0 -> #0:0 (h264 (native) -> h264 (h264_v4l2m2m)) Stream #0:0 -> #0:1 (pcm_s16le (native) -> aac (libfdk_aac)) Press [q] to stop, [?] for help [h264_v4l2m2m @ 0x2cf1e0] <<< v4l2_encode_init: fmt=0/-1 [h264_v4l2m2m @ 0x2cf1e0] Using device /dev/video11 [h264_v4l2m2m @ 0x2cf1e0] driver 'bcm2835-codec' on card 'bcm2835-codec-encode' in mplane mode [h264_v4l2m2m @ 0x2cf1e0] requesting formats: output=YU12 capture=H264 [alsa @ 0x28f010] Thread message queue blocking; consider raising the thread_queue_size option (current value: 256) Output #0, rtsp, to 'rtsp://localhost:8556/mystream': Metadata: encoder : Lavf58.45.100 Stream #0:0: Video: h264 (h264_v4l2m2m), yuv420p(progressive), 640x360, q=-1--1, 1500 kb/s, 25 fps, 90k tbn, 25 tbc Metadata: encoder : Lavc58.91.100 h264_v4l2m2m Stream #0:1: Audio: aac (libfdk_aac), 48000 Hz, stereo, s16, 32 kb/s Metadata: encoder : Lavc58.91.100 libfdk_aac frame= 320 fps= 26 q=-0.0 Lsize=N/A time=00:00:12.78 bitrate=N/A dup=7 drop=0 speed=1.03x
but the recieving is
Playing: rtsp://spook:&5SQZ20!@devil.virgin-fish.at:8556/mystream [ffmpeg/demuxer] rtsp: Missing PPS in sprop-parameter-sets, ignoring [ffmpeg/video] h264: non-existing PPS 0 referenced [ffmpeg/video] h264: non-existing PPS 0 referenced [ffmpeg/video] h264: decode_slice_header error [ffmpeg/video] h264: no frame!
Fair enough. Assuming you can compile ffmpeg - try this patch:
diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c
index 97e3ef6da3..0ab8875d24 100644
--- a/libavformat/rtspenc.c
+++ b/libavformat/rtspenc.c
@@ -250,6 +250,6 @@ AVOutputFormat ff_rtsp_muxer = {
.write_header = rtsp_write_header,
.write_packet = rtsp_write_packet,
.write_trailer = rtsp_write_close,
- .flags = AVFMT_NOFILE | AVFMT_GLOBALHEADER,
+ .flags = AVFMT_NOFILE,
.priv_class = &rtsp_muxer_class,
};
I don't guarantee it'll fix anything but it fixed my test setup (which isn't in any way the same as yours except that it tried to use an rtsp transport).
If that doesn't work I have some substantially more complicated things to try.
yes i think so its a long time bug history and sorry for my bad english
you update 2 month before ffmpeg i think 4.1 or 4.2 with this versions are allready ok with rtsp
maybe it helps
hi and hello !
I hope there comes a new version that works! as of this writing i use copy option and -f v4l2 -input_format h264 and it works ! the new ffmpeg 5.1.2 update 2 days ago doesn't work at all for rtsp h264_v4l2m2m non monutonus output or something
no luck for now with diff --git a/libavformat/rtspenc.c b/libavformat/rtspenc.c
but i use copy so no problem
And thanks for everything
great work
so quick 4.3.6 on bullseye running thank you so much
sorry its working on 32 bit 5.1.3 and 64 bit
the error befor comes from -nobuffer option
thank you for the great work
spooky
working
hi and hello !!!
ffmpeg 4.3.5
i stream with this comand
ffmpeg -hide_banner -async 1 \ -f alsa -ac 1 -i hw:CARD=Device,DEV=0 -f v4l2 -input_format h264 \ -re -i /dev/video0 -c:v h264_v4l2m2m -b:v 1M -pix_fmt yuv420p \ -c:a libopus -b:a 32k -application lowdelay \ -f rtsp -rtsp_transport tcp rtsp://localhost:8554/mystream
and recieving with
mpv rtsp://spook:password@lucy:8557/mystream
stream is running but when recieving with mpv
error
h264: non-existing PPS 0 referenced [ffmpeg/video] h264: decode_slice_header error [ffmpeg/video] h264: no frame!
i ask rtsp-simple-server and he answerd with
this was not generating SPS/PPS with FFmpeg 4.3.5 Anyway, the server is only responsible for receiving data from FFmpeg, it doesn't influence how the data is generated. If problem persists, it's a FFmpeg issue.
thank you for your big great work