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

ALSA Audio from Raspberry PI: FFmpeg exited with code 1 #360

Closed
odx opened this issue Oct 3, 2019 · 7 comments
Closed

ALSA Audio from Raspberry PI: FFmpeg exited with code 1 #360

odx opened this issue Oct 3, 2019 · 7 comments

Comments

@odx
Copy link

odx commented Oct 3, 2019

At the moment I am trying to configure a Raspberry PI Zero W as HomeKit Camera.
The final goal will be to use this as video doorbell with two way audio.

I got stuck configuring the plain homebridge-camera-ffmpeg plugin with one-way audio. As soon as I add the alsa audio input to the config, I get the following error in the log:

[10/3/2019, 8:17:25 PM] [Camera-ffmpeg] ERROR: FFmpeg exited with code 1

I can record audio with the following two commands:

arecord -f S32_LE -r 48000 -D hw:0,0 -d 5 -c 2 capture.wav
arecord -f S32_LE -r 48000 -D plughw:0,0 capture.wav

My config is:

{
        "platform": "Camera-ffmpeg",
        "cameras": [
          {
            "name": "Door Cam",
            "uploader": false,
            "videoConfig": {
                "source": "-re -f video4linux2 -i /dev/video0 -f alsa -i plughw:0,0",
                "stillImageSource": "-re -f video4linux2 -ss 0.9 -i /dev/video0 -vframes 1",
                "maxStreams": 2,
                "maxWidth": 1920,
                "maxHeight": 1080,
                "maxFPS": 30,
                "vcodec": "h264_omx",
                "audio": true,
                "debug": true
            }
          }
        ]
      }

And this is the resulting debug log when I attempt to open the stream in the Home App:

Oct 03 20:17:22 raspberrypi homebridge[2116]: [10/3/2019, 8:17:22 PM] [Camera-ffmpeg] Snapshot from Door Cam at 480x270
Oct 03 20:17:22 raspberrypi homebridge[2116]: ffmpeg -re -f video4linux2 -ss 0.9 -i /dev/video0 -vframes 1 -t 1 -s 480x270 -f image2 -
Oct 03 20:17:24 raspberrypi homebridge[2116]: [10/3/2019, 8:17:24 PM] [Camera-ffmpeg] Start streaming video from Door Cam with 1280x720@299kBit
Oct 03 20:17:24 raspberrypi homebridge[2116]: ffmpeg -re -f video4linux2 -i /dev/video0 -f alsa -i plughw:0,0 -map 0:0 -vcodec h264_omx -pix_fmt yuv420p -r 30 -f rawvideo -tune zerolatency -vf scale=1280:720 -b:v 299k -bufsize 299k -maxrate 299k -payload_type 99 -ssrc 70706 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params mJ1gh6/7CFR3GNnRfai6F8fjtcE0Z9DAZOGVRalK srtp://192.168.188.66:54395?rtcpport=54395&localrtcpport=54395&pkt_size=1316 -map 0:1 -acodec libfdk_aac -profile:a aac_eld -flags +global_header -f null -ar 16k -b:a 24k -bufsize 24k -ac 1 -payload_type 110 -ssrc 7786843 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params JSET6r2JGtBzX3P46PvECwvqYusnulIBjntkMgod srtp://192.168.188.66:56071?rtcpport=56071&localrtcpport=56071&pkt_size=1316 -loglevel debug
Oct 03 20:17:24 raspberrypi homebridge[2116]: ffmpeg version N-95194-g1b2ed0c392 Copyright (c) 2000-2019 the FFmpeg developers
Oct 03 20:17:24 raspberrypi homebridge[2116]:   built with gcc 8 (Raspbian 8.3.0-6+rpi1)
Oct 03 20:17:24 raspberrypi homebridge[2116]:   configuration: --prefix=/usr/local --arch=armel --target-os=linux --enable-omx-rpi --enable-nonfree --enable-gpl --enable-libfdk-aac --enable-mmal --enable-libx264 --enable-decoder=h264 --enable-network --enable-protocol=tcp --enable-demuxer=rtsp
Oct 03 20:17:24 raspberrypi homebridge[2116]:   libavutil      56. 35.100 / 56. 35.100
Oct 03 20:17:24 raspberrypi homebridge[2116]:   libavcodec     58. 59.101 / 58. 59.101
Oct 03 20:17:24 raspberrypi homebridge[2116]:   libavformat    58. 33.100 / 58. 33.100
Oct 03 20:17:24 raspberrypi homebridge[2116]:   libavdevice    58.  9.100 / 58.  9.100
Oct 03 20:17:24 raspberrypi homebridge[2116]:   libavfilter     7. 61.100 /  7. 61.100
Oct 03 20:17:24 raspberrypi homebridge[2116]:   libswscale      5.  6.100 /  5.  6.100
Oct 03 20:17:24 raspberrypi homebridge[2116]:   libswresample   3.  6.100 /  3.  6.100
Oct 03 20:17:24 raspberrypi homebridge[2116]:   libpostproc    55.  6.100 / 55.  6.100
Oct 03 20:17:24 raspberrypi homebridge[2116]: Splitting the commandline.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-re' ... matched as option 're' (read input at native frame rate) with argument '1'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-f' ... matched as option 'f' (force format) with argument 'video4linux2'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-i' ... matched as input url with argument '/dev/video0'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-f' ... matched as option 'f' (force format) with argument 'alsa'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-i' ... matched as input url with argument 'plughw:0,0'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:0'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'h264_omx'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'yuv420p'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-r' ... matched as option 'r' (set frame rate (Hz value, fraction or abbreviation)) with argument '30'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-f' ... matched as option 'f' (force format) with argument 'rawvideo'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-tune' ...
Oct 03 20:17:24 raspberrypi homebridge[2116]:  matched as AVOption 'tune' with argument 'zerolatency'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-vf' ...
Oct 03 20:17:24 raspberrypi homebridge[2116]:  matched as option 'vf' (set video filters) with argument 'scale=1280:720'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-b:v' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '299k'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-bufsize' ...
Oct 03 20:17:24 raspberrypi homebridge[2116]:  matched as AVOption 'bufsize' with argument '299k'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-maxrate' ...
Oct 03 20:17:24 raspberrypi homebridge[2116]:  matched as AVOption 'maxrate' with argument '299k'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-payload_type' ...
Oct 03 20:17:24 raspberrypi homebridge[2116]:  matched as AVOption 'payload_type' with argument '99'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-ssrc' ...
Oct 03 20:17:24 raspberrypi homebridge[2116]:  matched as AVOption 'ssrc' with argument '70706'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-f' ...
Oct 03 20:17:24 raspberrypi homebridge[2116]:  matched as option 'f' (force format) with argument 'rtp'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-srtp_out_suite' ...
Oct 03 20:17:24 raspberrypi homebridge[2116]:  matched as AVOption 'srtp_out_suite' with argument 'AES_CM_128_HMAC_SHA1_80'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-srtp_out_params' ... matched as AVOption 'srtp_out_params' with argument 'mJ1gh6/7CFR3GNnRfai6F8fjtcE0Z9DAZOGVRalK'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option 'srtp://192.168.188.66:54395?rtcpport=54395&localrtcpport=54395&pkt_size=1316' ... matched as output url.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:1'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'libfdk_aac'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-profile:a' ... matched as option 'profile' (set profile) with argument 'aac_eld'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-flags' ... matched as AVOption 'flags' with argument '+global_header'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-f' ... matched as option 'f' (force format) with argument 'null'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-ar' ... matched as option 'ar' (set audio sampling rate (in Hz)) with argument '16k'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-b:a' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '24k'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-bufsize' ...
Oct 03 20:17:24 raspberrypi homebridge[2116]:  matched as AVOption 'bufsize' with argument '24k'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-ac' ...
Oct 03 20:17:24 raspberrypi homebridge[2116]:  matched as option 'ac' (set number of audio channels) with argument '1'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-payload_type' ... matched as AVOption 'payload_type' with argument '110'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-ssrc' ...
Oct 03 20:17:24 raspberrypi homebridge[2116]:  matched as AVOption 'ssrc' with argument '7786843'.
Oct 03 20:17:24 raspberrypi homebridge[2116]: Reading option '-f' ...
Oct 03 20:17:25 raspberrypi homebridge[2116]:  matched as option 'f' (force format) with argument 'rtp'.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Reading option '-srtp_out_suite' ... matched as AVOption 'srtp_out_suite' with argument 'AES_CM_128_HMAC_SHA1_80'.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Reading option '-srtp_out_params' ...
Oct 03 20:17:25 raspberrypi homebridge[2116]:  matched as AVOption 'srtp_out_params' with argument 'JSET6r2JGtBzX3P46PvECwvqYusnulIBjntkMgod'.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Reading option 'srtp://192.168.188.66:56071?rtcpport=56071&localrtcpport=56071&pkt_size=1316' ...
Oct 03 20:17:25 raspberrypi homebridge[2116]:  matched as output url.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Finished splitting the commandline.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Parsing a group of options: global .
Oct 03 20:17:25 raspberrypi homebridge[2116]: Applying option loglevel (set logging level) with argument debug.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Successfully parsed a group of options.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Parsing a group of options: input url /dev/video0.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Applying option re (read input at native frame rate) with argument 1.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Applying option f (force format) with argument video4linux2.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Successfully parsed a group of options.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Opening an input file: /dev/video0.
Oct 03 20:17:25 raspberrypi homebridge[2116]: [video4linux2,v4l2 @ 0x1e6ea80] fd:3 capabilities:85200005
Oct 03 20:17:25 raspberrypi homebridge[2116]: [video4linux2,v4l2 @ 0x1e6ea80] Current input_channel: 0, input_name: Camera 0, input_std: 0
Oct 03 20:17:25 raspberrypi homebridge[2116]: [video4linux2,v4l2 @ 0x1e6ea80] Querying the device for the current frame size
Oct 03 20:17:25 raspberrypi homebridge[2116]: [video4linux2,v4l2 @ 0x1e6ea80] Setting frame size to 1280x720
Oct 03 20:17:25 raspberrypi homebridge[2116]: [video4linux2,v4l2 @ 0x1e6ea80]
Oct 03 20:17:25 raspberrypi homebridge[2116]: All info found
Oct 03 20:17:25 raspberrypi homebridge[2116]: Input #0, video4linux2,v4l2, from '/dev/video0':
Oct 03 20:17:25 raspberrypi homebridge[2116]:   Duration: N/A, start: 52791.397962, bitrate: 276480 kb/s
Oct 03 20:17:25 raspberrypi homebridge[2116]:     Stream #0:0, 1, 1/1000000: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 1280x720, 0/1, 276480 kb/s, 25 fps, 25 tbr, 1000k tbn, 1000k tbc
Oct 03 20:17:25 raspberrypi homebridge[2116]: Successfully opened the file.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Parsing a group of options: input url plughw:0,0.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Applying option f (force format) with argument alsa.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Successfully parsed a group of options.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Opening an input file: plughw:0,0.
Oct 03 20:17:25 raspberrypi homebridge[2116]: [alsa @ 0x1e71680]
Oct 03 20:17:25 raspberrypi homebridge[2116]: All info found
Oct 03 20:17:25 raspberrypi homebridge[2116]: Guessed Channel Layout for Input Stream #1.0 : stereo
Oct 03 20:17:25 raspberrypi homebridge[2116]: Input #1, alsa, from 'plughw:0,0':
Oct 03 20:17:25 raspberrypi homebridge[2116]:   Duration: N/A, start: 1570130245.643218, bitrate: 1536 kb/s
Oct 03 20:17:25 raspberrypi homebridge[2116]:     Stream #1:0, 1, 1/1000000: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Oct 03 20:17:25 raspberrypi homebridge[2116]: Successfully opened the file.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Parsing a group of options: output url srtp://192.168.188.66:54395?rtcpport=54395&localrtcpport=54395&pkt_size=1316.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Applying option map (set input stream mapping) with argument 0:0.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Applying option vcodec (force video codec ('copy' to copy stream)) with argument h264_omx.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Applying option pix_fmt (set pixel format) with argument yuv420p.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Applying option r (set frame rate (Hz value, fraction or abbreviation)) with argument 30.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Applying option f (force format) with argument rawvideo.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Applying option vf (set video filters) with argument scale=1280:720.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Applying option b:v (video bitrate (please use -b:v)) with argument 299k.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Applying option f (force format) with argument rtp.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Successfully parsed a group of options.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Opening an output file: srtp://192.168.188.66:54395?rtcpport=54395&localrtcpport=54395&pkt_size=1316.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Codec AVOption tune (Tune the encoding params (cf. x264 --fullhelp)) specified for output file #0 (srtp://192.168.188.66:54395?rtcpport=54395&localrtcpport=54395&pkt_size=1316) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Oct 03 20:17:25 raspberrypi homebridge[2116]: [srtp @ 0x1e814d0] No default whitelist set
Oct 03 20:17:25 raspberrypi homebridge[2116]: [rtp @ 0x1e83a70] No default whitelist set
Oct 03 20:17:25 raspberrypi homebridge[2116]: [udp @ 0x1e83e20] No default whitelist set
Oct 03 20:17:25 raspberrypi homebridge[2116]: [udp @ 0x1e94220] No default whitelist set
Oct 03 20:17:25 raspberrypi homebridge[2116]: Successfully opened the file.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Parsing a group of options: output url srtp://192.168.188.66:56071?rtcpport=56071&localrtcpport=56071&pkt_size=1316.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Applying option map (set input stream mapping) with argument 0:1.
Oct 03 20:17:25 raspberrypi homebridge[2116]: Stream map '0:1' matches no streams.
Oct 03 20:17:25 raspberrypi homebridge[2116]: To ignore this, add a trailing '?' to the map.
Oct 03 20:17:25 raspberrypi homebridge[2116]: [AVIOContext @ 0x1e94090] Statistics: 0 seeks, 0 writeouts
Oct 03 20:17:25 raspberrypi homebridge[2116]: [10/3/2019, 8:17:25 PM] [Camera-ffmpeg] ERROR: FFmpeg exited with code 1

Any ideas what I am doing wrong?

@llemtt
Copy link

llemtt commented Oct 4, 2019

invert the order of the ffmpeg sources with audio first like this

"-re -f alsa -i plughw:0,0 -f video4linux2 -i /dev/video0"

@odx
Copy link
Author

odx commented Oct 4, 2019

I was playing around with the order earlier... I used your source configuration but this didn't help:

ffmpeg -re -f video4linux2 -ss 0.9 -i /dev/video0 -vframes 1 -t 1 -s 480x270 -f image2 -
Oct 04 18:49:20 raspberrypi homebridge[3094]: [10/4/2019, 6:49:20 PM] [Camera-ffmpeg] Start streaming video from Door Cam with 1280x720@299kBit
Oct 04 18:49:20 raspberrypi homebridge[3094]: ffmpeg -re -f alsa -i plughw:0,0 -f video4linux2 -i /dev/video0 -map 0:0 -vcodec h264_omx -pix_fmt yuv420p -r 30 -f rawvideo -tune zerolatency -vf scale=1280:720 -b:v 299k -bufsize 299k -maxrate 299k -payload_type 99 -ssrc 15222246 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params Qvn9tZayyBcMlAMZ8GaJmFgAxABYllmWC0RggJUI srtp://192.168.188.93:63122?rtcpport=63122&localrtcpport=63122&pkt_size=1316 -map 0:1 -acodec libfdk_aac -profile:a aac_eld -flags +global_header -f null -ar 16k -b:a 24k -bufsize 24k -ac 1 -payload_type 110 -ssrc 12566866 -f rtp -srtp_out_suite AES_CM_128_HMAC_SHA1_80 -srtp_out_params 7o9avNLpTA4bsS/u5fqhc9ZXeyeMAUbl1sJ5yM4U srtp://192.168.188.93:51321?rtcpport=51321&localrtcpport=51321&pkt_size=1316 -loglevel debug
Oct 04 18:49:20 raspberrypi homebridge[3094]: ffmpeg version N-95194-g1b2ed0c392
Oct 04 18:49:20 raspberrypi homebridge[3094]:  Copyright (c) 2000-2019 the FFmpeg developers
Oct 04 18:49:20 raspberrypi homebridge[3094]:   built with gcc 8 (Raspbian 8.3.0-6+rpi1)
Oct 04 18:49:20 raspberrypi homebridge[3094]:   configuration: --prefix=/usr/local --arch=armel --target-os=linux --enable-omx-rpi --enable-nonfree --enable-gpl --enable-libfdk-aac --enable-mmal --enable-libx264 --enable-decoder=h264 --enable-network --enable-protocol=tcp --enable-demuxer=rtsp
Oct 04 18:49:20 raspberrypi homebridge[3094]:   libavutil      56. 35.100 / 56. 35.100
Oct 04 18:49:20 raspberrypi homebridge[3094]:   libavcodec     58. 59.101 / 58. 59.101
Oct 04 18:49:20 raspberrypi homebridge[3094]:   libavformat    58. 33.100 / 58. 33.100
Oct 04 18:49:20 raspberrypi homebridge[3094]:   libavdevice    58.  9.100 / 58.  9.100
Oct 04 18:49:20 raspberrypi homebridge[3094]:   libavfilter     7. 61.100 /  7. 61.100
Oct 04 18:49:20 raspberrypi homebridge[3094]:   libswscale      5.  6.100 /  5.  6.100
Oct 04 18:49:20 raspberrypi homebridge[3094]:   libswresample   3.  6.100 /  3.  6.100
Oct 04 18:49:20 raspberrypi homebridge[3094]:   libpostproc    55.  6.100 / 55.  6.100
Oct 04 18:49:20 raspberrypi homebridge[3094]: Splitting the commandline.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-re' ... matched as option 're' (read input at native frame rate) with argument '1'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-f' ... matched as option 'f' (force format) with argument 'alsa'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-i' ... matched as input url with argument 'plughw:0,0'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-f' ... matched as option 'f' (force format) with argument 'video4linux2'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-i' ... matched as input url with argument '/dev/video0'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:0'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-vcodec' ... matched as option 'vcodec' (force video codec ('copy' to copy stream)) with argument 'h264_omx'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-pix_fmt' ... matched as option 'pix_fmt' (set pixel format) with argument 'yuv420p'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-r' ... matched as option 'r' (set frame rate (Hz value, fraction or abbreviation)) with argument '30'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-f' ... matched as option 'f' (force format) with argument 'rawvideo'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-tune' ...
Oct 04 18:49:20 raspberrypi homebridge[3094]:  matched as AVOption 'tune' with argument 'zerolatency'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-vf' ...
Oct 04 18:49:20 raspberrypi homebridge[3094]:  matched as option 'vf' (set video filters) with argument 'scale=1280:720'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-b:v' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '299k'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-bufsize' ...
Oct 04 18:49:20 raspberrypi homebridge[3094]:  matched as AVOption 'bufsize' with argument '299k'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-maxrate' ...
Oct 04 18:49:20 raspberrypi homebridge[3094]:  matched as AVOption 'maxrate' with argument '299k'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-payload_type' ...
Oct 04 18:49:20 raspberrypi homebridge[3094]:  matched as AVOption 'payload_type' with argument '99'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-ssrc' ...
Oct 04 18:49:20 raspberrypi homebridge[3094]:  matched as AVOption 'ssrc' with argument '15222246'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-f' ...
Oct 04 18:49:20 raspberrypi homebridge[3094]:  matched as option 'f' (force format) with argument 'rtp'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-srtp_out_suite' ... matched as AVOption 'srtp_out_suite' with argument 'AES_CM_128_HMAC_SHA1_80'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-srtp_out_params' ... matched as AVOption 'srtp_out_params' with argument 'Qvn9tZayyBcMlAMZ8GaJmFgAxABYllmWC0RggJUI'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option 'srtp://192.168.188.93:63122?rtcpport=63122&localrtcpport=63122&pkt_size=1316' ... matched as output url.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0:1'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-acodec' ... matched as option 'acodec' (force audio codec ('copy' to copy stream)) with argument 'libfdk_aac'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-profile:a' ... matched as option 'profile' (set profile) with argument 'aac_eld'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-flags' ...
Oct 04 18:49:20 raspberrypi homebridge[3094]:  matched as AVOption 'flags' with argument '+global_header'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-f' ...
Oct 04 18:49:20 raspberrypi homebridge[3094]:  matched as option 'f' (force format) with argument 'null'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-ar' ... matched as option 'ar' (set audio sampling rate (in Hz)) with argument '16k'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-b:a' ... matched as option 'b' (video bitrate (please use -b:v)) with argument '24k'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-bufsize' ... matched as AVOption 'bufsize' with argument '24k'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-ac' ... matched as option 'ac' (set number of audio channels) with argument '1'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-payload_type' ...
Oct 04 18:49:20 raspberrypi homebridge[3094]:  matched as AVOption 'payload_type' with argument '110'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-ssrc' ...
Oct 04 18:49:20 raspberrypi homebridge[3094]:  matched as AVOption 'ssrc' with argument '12566866'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-f' ... matched as option 'f' (force format) with argument 'rtp'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-srtp_out_suite' ... matched as AVOption 'srtp_out_suite' with argument 'AES_CM_128_HMAC_SHA1_80'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-srtp_out_params' ...
Oct 04 18:49:20 raspberrypi homebridge[3094]:  matched as AVOption 'srtp_out_params' with argument '7o9avNLpTA4bsS/u5fqhc9ZXeyeMAUbl1sJ5yM4U'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option 'srtp://192.168.188.93:51321?rtcpport=51321&localrtcpport=51321&pkt_size=1316' ...
Oct 04 18:49:20 raspberrypi homebridge[3094]:  matched as output url.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Reading option '-loglevel' ... matched as option 'loglevel' (set logging level) with argument 'debug'.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Finished splitting the commandline.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Parsing a group of options: global .
Oct 04 18:49:20 raspberrypi homebridge[3094]: Applying option loglevel (set logging level) with argument debug.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Successfully parsed a group of options.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Parsing a group of options: input url plughw:0,0.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Applying option re (read input at native frame rate) with argument 1.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Applying option f (force format) with argument alsa.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Successfully parsed a group of options.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Opening an input file: plughw:0,0.
Oct 04 18:49:20 raspberrypi homebridge[3094]: [alsa @ 0x30a4a90]
Oct 04 18:49:20 raspberrypi homebridge[3094]: All info found
Oct 04 18:49:20 raspberrypi homebridge[3094]: Guessed Channel Layout for Input Stream #0.0 : stereo
Oct 04 18:49:20 raspberrypi homebridge[3094]: Input #0, alsa, from 'plughw:0,0':
Oct 04 18:49:20 raspberrypi homebridge[3094]:   Duration: N/A, start: 1570211360.778211, bitrate: 1536 kb/s
Oct 04 18:49:20 raspberrypi homebridge[3094]:     Stream #0:0, 1, 1/1000000: Audio: pcm_s16le, 48000 Hz, stereo, s16, 1536 kb/s
Oct 04 18:49:20 raspberrypi homebridge[3094]: Successfully opened the file.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Parsing a group of options: input url /dev/video0.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Applying option f (force format) with argument video4linux2.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Successfully parsed a group of options.
Oct 04 18:49:20 raspberrypi homebridge[3094]: Opening an input file: /dev/video0.
Oct 04 18:49:20 raspberrypi homebridge[3094]: [video4linux2,v4l2 @ 0x30b2be0] fd:3 capabilities:85200005
Oct 04 18:49:20 raspberrypi homebridge[3094]: [video4linux2,v4l2 @ 0x30b2be0] Current input_channel: 0, input_name: Camera 0, input_std: 0
Oct 04 18:49:20 raspberrypi homebridge[3094]: [video4linux2,v4l2 @ 0x30b2be0] Querying the device for the current frame size
Oct 04 18:49:20 raspberrypi homebridge[3094]: [video4linux2,v4l2 @ 0x30b2be0] Setting frame size to 1280x720
Oct 04 18:49:21 raspberrypi homebridge[3094]: [video4linux2,v4l2 @ 0x30b2be0]
Oct 04 18:49:21 raspberrypi homebridge[3094]: All info found
Oct 04 18:49:21 raspberrypi homebridge[3094]: Input #1, video4linux2,v4l2, from '/dev/video0':
Oct 04 18:49:21 raspberrypi homebridge[3094]:   Duration: N/A, start: 133907.285474, bitrate: 276480 kb/s
Oct 04 18:49:21 raspberrypi homebridge[3094]:     Stream #1:0, 1, 1/1000000: Video: rawvideo, 1 reference frame (I420 / 0x30323449), yuv420p, 1280x720, 0/1, 276480 kb/s, 25 fps,
Oct 04 18:49:21 raspberrypi homebridge[3094]: 25 tbr, 1000k tbn, 1000k tbc
Oct 04 18:49:21 raspberrypi homebridge[3094]: Successfully opened the file.
Oct 04 18:49:21 raspberrypi homebridge[3094]: Parsing a group of options: output url srtp://192.168.188.93:63122?rtcpport=63122&localrtcpport=63122&pkt_size=1316.
Oct 04 18:49:21 raspberrypi homebridge[3094]: Applying option map (set input stream mapping) with argument 0:0.
Oct 04 18:49:21 raspberrypi homebridge[3094]: Applying option vcodec (force video codec ('copy' to copy stream)) with argument h264_omx.
Oct 04 18:49:21 raspberrypi homebridge[3094]: Applying option pix_fmt (set pixel format) with argument yuv420p.
Oct 04 18:49:21 raspberrypi homebridge[3094]: Applying option r (set frame rate (Hz value, fraction or abbreviation)) with argument 30.
Oct 04 18:49:21 raspberrypi homebridge[3094]: Applying option f (force format) with argument rawvideo.
Oct 04 18:49:21 raspberrypi homebridge[3094]: Applying option vf (set video filters) with argument scale=1280:720.
Oct 04 18:49:21 raspberrypi homebridge[3094]: Applying option b:v (video bitrate (please use -b:v)) with argument 299k.
Oct 04 18:49:21 raspberrypi homebridge[3094]: Applying option f (force format) with argument rtp.
Oct 04 18:49:21 raspberrypi homebridge[3094]: Successfully parsed a group of options.
Oct 04 18:49:21 raspberrypi homebridge[3094]: Opening an output file: srtp://192.168.188.93:63122?rtcpport=63122&localrtcpport=63122&pkt_size=1316.
Oct 04 18:49:21 raspberrypi homebridge[3094]: Codec AVOption tune (Tune the encoding params (cf. x264 --fullhelp)) specified for output file #0 (srtp://192.168.188.93:63122?rtcpport=63122&localrtcpport=63122&pkt_size=1316) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Oct 04 18:49:21 raspberrypi homebridge[3094]: Codec AVOption b (set bitrate (in bits/s)) specified for output file #0 (srtp://192.168.188.93:63122?rtcpport=63122&localrtcpport=63122&pkt_size=1316) has not been used for any stream. The most likely reason is either wrong type (e.g. a video option with no video streams) or that it is a private option of some encoder which was not actually used for any stream.
Oct 04 18:49:21 raspberrypi homebridge[3094]: [srtp @ 0x30b7470] No default whitelist set
Oct 04 18:49:21 raspberrypi homebridge[3094]: [rtp @ 0x30b9a20] No default whitelist set
Oct 04 18:49:21 raspberrypi homebridge[3094]: [udp @ 0x30b9d60] No default whitelist set
Oct 04 18:49:21 raspberrypi homebridge[3094]: [udp @ 0x30ca1b0]
Oct 04 18:49:21 raspberrypi homebridge[3094]: No default whitelist set
Oct 04 18:49:21 raspberrypi homebridge[3094]: Successfully opened the file.
Oct 04 18:49:21 raspberrypi homebridge[3094]: Parsing a group of options: output url srtp://192.168.188.93:51321?rtcpport=51321&localrtcpport=51321&pkt_size=1316.
Oct 04 18:49:21 raspberrypi homebridge[3094]: Applying option map (set input stream mapping) with argument 0:1.
Oct 04 18:49:21 raspberrypi homebridge[3094]: Stream map '0:1' matches no streams.
Oct 04 18:49:21 raspberrypi homebridge[3094]: To ignore this, add a trailing '?' to the map.
Oct 04 18:49:21 raspberrypi homebridge[3094]: [AVIOContext @ 0x30c9fd0] Statistics: 0 seeks, 0 writeouts
Oct 04 18:49:21 raspberrypi homebridge[3094]: [10/4/2019, 6:49:21 PM] [Camera-ffmpeg] ERROR: FFmpeg exited with code 1

@odx
Copy link
Author

odx commented Oct 6, 2019

I checked the available streams in my config with

ffmpeg -i <input> 2>&1 | grep "Stream #"

And added

                "mapvideo": "1,0",
                "mapaudio": "0,0"

to my config which solved this issue.

@odx odx closed this as completed Oct 6, 2019
@burnbrigther
Copy link

@odx can you please share your camera configuration in your config.json? I would like to see how you put in the mapping. Thank you

@odx
Copy link
Author

odx commented Jun 2, 2020

Sure. Please note that I am using homebridge-videodoorbell with the two-way-audio-patch.

        {
            "platform": "Video-doorbell",
            "cameras": [
                {
                    "name": "Doorbell",
                    "port": 5005,
                    "videoConfig": {
                        "source": "-f alsa -ar 16000 -thread_queue_size 2048 -i default -f video4linux2 -input_format h264 -video_size 1280x720 -framerate 30 -i /dev/video0",
                        "stillImageSource": "-re -f video4linux2 -ss 0.9 -i /dev/video0 -vframes 1",
                        "maxStreams": 2,
                        "maxWidth": 1280,
                        "maxHeight": 720,
                        "maxFPS": 30,
                        "vcodec": "copy",
                        "videoFilter": "none",
                        "audio": "2way -f alsa default -ar 16000 -thread_queue_size 2048",
                        "debug": true,
                        "mapvideo": "1,0",
                        "mapaudio": "0,0",
                        "packetSize": 1378,
                        "additionalCommandline": " "
                    }
                }
            ]
        }

@burnbrigther
Copy link

burnbrigther commented Jun 2, 2020

I am using both those too. But cannot get around "ERROR: Speaker FFmpeg exited with code 1". Probably not appropriate for this thread. But wondering if you ran in to similar and how you fixed it?

[Speaker]     Last message repeated 96 times
av_interleaved_write_frame(): Broken pipe
No more output streams to write to, finishing.

[Speaker] Error writing trailer of http://XXXXX:[email protected]/axis-cgi/audio/transmit.cgi: Broken pipe
size=      37kB time=00:00:02.91 bitrate= 104.6kbits/s speed=0.164x    
video:0kB audio:38kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Input file #0 (pipe:):
  Input stream #0:0 (audio): 98 packets read (10878 bytes); 98 frames decoded (50176 samples); 
  Total: 98 packets (10878 bytes) demuxed
Output file #0 (http://XXXXX:[email protected]/axis-cgi/audio/transmit.cgi):
  Output stream #0:0 (audio): 98 frames encoded (38556 samples); 98 packets muxed (38556 bytes); 
  Total: 98 packets (38556 bytes) muxed
98 frames successfully decoded, 0 decoding errors

[Speaker] [AVIOContext @ 0x249ab30] Statistics: 0 seeks, 98 writeouts

[Speaker] [AVIOContext @ 0x24163e0] Statistics: 331 bytes read, 0 seeks
Conversion failed!

[6/2/2020, 10:33:11 AM] [Video Doorbell] ERROR: Speaker FFmpeg exited with code 1

@manyxu
Copy link

manyxu commented Jun 27, 2020

i use nodejs "fluent-ffmpeg" to send rtmp video stream to my server, and find the same problem with audio
But when i read all abover ! i change hw:2,0 to plughw:2,0, my audio run ok!!!

.input('/dev/video0')
.inputFormat('v4l2')
.input('plughw:2,0')
.inputFormat('alsa')
.addOptions([
'-vcodec libx264',
'-preset ultrafast',
'-pix_fmt yuv422p',
'-tune:v zerolatency',
'-framerate 25',
'-acodec aac',
'-ac 1',
'-ar 16000',
'-s 320*240',
'-bufsize 1024',
'-ab 96k',
'-g 0.1'
])

commandLine: ffmpeg -f v4l2 -i /dev/video0 -f alsa -i plughw:2,0 -vcodec libx264 -preset ultrafast -pix_fmt yuv422p -tune:v zerolatency -framerate 25 -acodec aac -ac 1 -ar 16000 -s 320240 -bufsize 1024 -ab 96k -g 0.1 -f flv rtmp://manykit.com/live/manykit?sign=**************************************

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants