mpromonet / v4l2rtspserver

RTSP Server for V4L2 device capture supporting HEVC/H264/JPEG/VP8/VP9
The Unlicense
1.82k stars 423 forks source link

Can't get audio use -a ALAW #264

Open centurion2021 opened 2 years ago

centurion2021 commented 2 years ago

Describe the bug I can run procss with -a ALAW -A 8000 without any error but no audio found in RTSP. if I remove audio options, then I can get audio in default format S16_BE successfully.

To Reproduce Steps to reproduce the behavior: hardware: Pi zero 2 W + ReSpeaker 2-Mics Pi HAT + raspberry camera v2 os: Raspberry OS lite(buster) command: v4l2rtspserver -a ALAW -A 8000 -u unicast -P 554 -W 1920 -H 1080 -F 30 /dev/video0,plughw:CARD=seeed2micvoicec

Expected behavior Get video along with audio(A-LAW)

Screenshots root@raspberrypi:/dev/snd# v4l2rtspserver -a ALAW -A 8000 -u unicast -P 554 -W 1920 -H 1080 -F 30 /dev/video0,plughw:CARD=seeed2micvoicec log level:500 [NOTICE] /root/install/v4l2rtspserver/main.cpp:294 Version: 0.2.4-8-g79a13bd live555 version:2021.12.18 [NOTICE] /root/install/v4l2rtspserver/src/V4l2RTSPServer.cpp:37 Create V4L2 Source.../dev/video0 [NOTICE] /root/install/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:133 driver:bm2835 mmal capabilities:85200005 mandatory:4000001 [NOTICE] /root/install/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:136 /dev/video0 support capture [NOTICE] /root/install/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:138 /dev/video0 support read/write [NOTICE] /root/install/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:139 /dev/video0 support streaming [NOTICE] /root/install/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:225 /dev/video0:H264 size:1920x1080 bufferSize:2088960 [NOTICE] /root/install/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:246 fps:1/30 [NOTICE] /root/install/v4l2rtspserver/v4l2wrapper/src/V4l2Device.cpp:247 nbBuffer:1 [NOTICE] /root/install/v4l2rtspserver/v4l2wrapper/src/V4l2MmapDevice.cpp:49 Device /dev/video0 [NOTICE] /root/install/v4l2rtspserver/v4l2wrapper/src/V4l2MmapDevice.cpp:73 Device /dev/video0 nb buffer:10 [NOTICE] /root/install/v4l2rtspserver/src/V4l2RTSPServer.cpp:62 Create Source .../dev/video0 [NOTICE] /root/install/v4l2rtspserver/src/V4L2DeviceSource.cpp:96 begin thread [NOTICE] /root/install/v4l2rtspserver/src/V4l2RTSPServer.cpp:184 Create ALSA Source...plughw:CARD=seeed2micvoicec [NOTICE] /root/install/v4l2rtspserver/src/ALSACapture.cpp:49 Open ALSA device: "plughw:CARD=seeed2micvoicec" [NOTICE] /root/install/v4l2rtspserver/src/ALSACapture.cpp:117 set sample format device: plughw:CARD=seeed2micvoicec to:21 ok [NOTICE] /root/install/v4l2rtspserver/src/ALSACapture.cpp:104 ALSA device: "plughw:CARD=seeed2micvoicec" buffer_size:131072 period_size:64 rate:8000 [NOTICE] /root/install/v4l2rtspserver/src/V4L2DeviceSource.cpp:96 begin thread [NOTICE] /root/install/v4l2rtspserver/inc/BaseServerMediaSubsession.h:49 format:video/H264 [NOTICE] /root/install/v4l2rtspserver/inc/BaseServerMediaSubsession.h:49 format:audio/PCMA/8000/2 [NOTICE] /root/install/v4l2rtspserver/inc/V4l2RTSPServer.h:80

root@raspberrypi:/dev/snd# arecord -L null Discard all samples (playback) or generate zero samples (capture) jack JACK Audio Connection Kit pulse PulseAudio Sound Server default playback capture dmixed array sysdefault:CARD=seeed2micvoicec seeed-2mic-voicecard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0 Default Audio Device dmix:CARD=seeed2micvoicec,DEV=0 seeed-2mic-voicecard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0 Direct sample mixing device dsnoop:CARD=seeed2micvoicec,DEV=0 seeed-2mic-voicecard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0 Direct sample snooping device hw:CARD=seeed2micvoicec,DEV=0 seeed-2mic-voicecard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0 Direct hardware device without any conversions plughw:CARD=seeed2micvoicec,DEV=0 seeed-2mic-voicecard, bcm2835-i2s-wm8960-hifi wm8960-hifi-0 Hardware device with all software conversions usbstream:CARD=seeed2micvoicec seeed-2mic-voicecard USB Stream Output

root@raspberrypi:/dev/snd# arecord -v -D plughw:CARD=seeed2micvoicec -t raw -f A_LAW -r 8000 -c 2 test_alaw.raw Recording raw data 'test_alaw.raw' : A-Law, Rate 8000 Hz, Stereo Plug PCM: A-Law conversion PCM (S16_LE) Its setup is: stream : CAPTURE access : RW_INTERLEAVED format : A_LAW subformat : STD channels : 2 rate : 8000 exact rate : 8000 (8000/1) msbits : 8 buffer_size : 4000 period_size : 1000 period_time : 125000 tstamp_mode : NONE tstamp_type : MONOTONIC period_step : 1 avail_min : 1000 period_event : 0 start_threshold : 1 stop_threshold : 4000 silence_threshold: 0 silence_size : 0 boundary : 2097152000 Slave: Hardware PCM card 0 'seeed-2mic-voicecard' device 0 subdevice 0 Its setup is: stream : CAPTURE access : MMAP_INTERLEAVED format : S16_LE subformat : STD channels : 2 rate : 8000 exact rate : 8000 (8000/1) msbits : 16 buffer_size : 4000 period_size : 1000 period_time : 125000 tstamp_mode : NONE tstamp_type : MONOTONIC period_step : 1 avail_min : 1000 period_event : 0 start_threshold : 1 stop_threshold : 4000 silence_threshold: 0 silence_size : 0 boundary : 2097152000 appl_ptr : 0 hw_ptr : 0

TheAsuraSlayer commented 9 months ago

Im having the same issue. Default codec is working fine. but not able to change it