diff --git a/rover/profiles/audioCapture.yaml b/rover/profiles/audioCapture.yaml index b6aac2fb..d260eb4e 100644 --- a/rover/profiles/audioCapture.yaml +++ b/rover/profiles/audioCapture.yaml @@ -6,13 +6,10 @@ apt-get update && apt-get install -y ffmpeg alsa-utils fi run: | - sample_rate=48000 - channels=2 - bitrate=510000 - arecord -D "$ROVER_AUDIO_INPUT_DEVICE" -f S32_LE -c "$channels" -r "$sample_rate" -B 16384 -F 1024 -q -t raw | + arecord -D "$ROVER_AUDIO_INPUT_DEVICE" -f S32_LE -c 2 -r 48000 -B 16384 -F 1024 -q -t raw | ffmpeg -nostdin -hide_banner -loglevel warning -fflags nobuffer \ - -rtbufsize 0 -thread_queue_size 4096 -f s32le -ar "$sample_rate" -ac "$channels" -i pipe:0 \ - -af "volume=20dB" -c:a libopus -b:a "$bitrate" -ar:a "$sample_rate" -ac:a "$channels" \ + -rtbufsize 0 -thread_queue_size 4096 -f s32le -ar 48000 -ac 2 -i pipe:0 \ + -af "volume=20dB" -c:a libopus -b:a 510000 -ar:a 48000 -ac:a 2 \ -application audio -frame_duration 20 -compression_level 0 \ -flush_packets 1 -muxdelay 0 -muxpreload 0 -f rtsp -rtsp_transport tcp "$ROVER_AUDIO_PUBLISH_URL" - id: aiy @@ -39,12 +36,9 @@ apt-get update && apt-get install -y ffmpeg alsa-utils fi run: | - sample_rate=48000 - channels=2 - bitrate=510000 - arecord -D "$ROVER_AUDIO_INPUT_DEVICE" -f S32_LE -c "$channels" -r "$sample_rate" -B 16384 -F 1024 -q -t raw | + arecord -D "$ROVER_AUDIO_INPUT_DEVICE" -f S32_LE -c 2 -r 48000 -B 16384 -F 1024 -q -t raw | ffmpeg -nostdin -hide_banner -loglevel warning -fflags nobuffer \ - -rtbufsize 0 -thread_queue_size 4096 -f s32le -ar "$sample_rate" -ac "$channels" -i pipe:0 \ - -af "volume=20dB" -c:a libopus -b:a "$bitrate" -ar:a "$sample_rate" -ac:a "$channels" \ + -rtbufsize 0 -thread_queue_size 4096 -f s32le -ar 48000 -ac 2 -i pipe:0 \ + -af "volume=20dB" -c:a libopus -b:a 510000 -ar:a 48000 -ac:a 2 \ -application audio -frame_duration 20 -compression_level 0 \ -flush_packets 1 -muxdelay 0 -muxpreload 0 -f rtsp -rtsp_transport tcp "$ROVER_AUDIO_PUBLISH_URL" diff --git a/rover/profiles/audioPlayback.yaml b/rover/profiles/audioPlayback.yaml index 6e73fea5..32536b19 100644 --- a/rover/profiles/audioPlayback.yaml +++ b/rover/profiles/audioPlayback.yaml @@ -6,13 +6,9 @@ apt-get update && apt-get install -y ffmpeg alsa-utils fi run: | - normalize=true - normalize_filter='dynaudnorm=f=75:g=15:m=10:p=0.9,alimiter=limit=0.85:level=disabled' - filters=() - if [ "$normalize" = true ]; then filters=(-af "$normalize_filter"); fi ffmpeg -nostdin -hide_banner -loglevel warning -fflags nobuffer -flags low_delay \ -analyzeduration 200k -probesize 32k -rtsp_transport tcp -i "$ROVER_AUDIO_PLAYBACK_URL" \ - -vn "${filters[@]}" -ac 1 -ar 16000 -f s16le pipe:1 | + -vn -af "dynaudnorm=f=75:g=15:m=10:p=0.9,alimiter=limit=0.85:level=disabled" -ac 1 -ar 16000 -f s16le pipe:1 | aplay -q -D "$ROVER_AUDIO_OUTPUT_DEVICE" -t raw -f S16_LE -r 16000 -c 1 - id: aiy name: Google AIY Voice HAT speaker (raspberry pi) @@ -38,11 +34,7 @@ apt-get update && apt-get install -y ffmpeg alsa-utils fi run: | - normalize=true - normalize_filter='dynaudnorm=f=75:g=15:m=10:p=0.9,alimiter=limit=0.85:level=disabled' - filters=() - if [ "$normalize" = true ]; then filters=(-af "$normalize_filter"); fi ffmpeg -nostdin -hide_banner -loglevel warning -fflags nobuffer -flags low_delay \ -analyzeduration 200k -probesize 32k -rtsp_transport tcp -i "$ROVER_AUDIO_PLAYBACK_URL" \ - -vn "${filters[@]}" -ac 1 -ar 16000 -f s16le pipe:1 | + -vn -af "dynaudnorm=f=75:g=15:m=10:p=0.9,alimiter=limit=0.85:level=disabled" -ac 1 -ar 16000 -f s16le pipe:1 | aplay -q -D "$ROVER_AUDIO_OUTPUT_DEVICE" -t raw -f S16_LE -r 16000 -c 1 diff --git a/rover/profiles/video.yaml b/rover/profiles/video.yaml index a880fb80..2784cdeb 100644 --- a/rover/profiles/video.yaml +++ b/rover/profiles/video.yaml @@ -6,23 +6,12 @@ apt-get update && apt-get install -y ffmpeg fi run: | - device=/dev/video0 - input_format=mjpeg - width=640 - height=480 - fps=30 - bitrate=2000000 - inverted=false - input_options=() - if [ -n "$input_format" ]; then input_options=(-input_format "$input_format"); fi - filters=() - if [ "$inverted" = true ]; then filters=(-vf "transpose=2,transpose=2"); fi exec ffmpeg -nostdin -hide_banner -loglevel warning -fflags nobuffer -flags low_delay \ - -thread_queue_size 4096 -f v4l2 "${input_options[@]}" -framerate "$fps" \ - -video_size "${width}x${height}" -i "$device" "${filters[@]}" -an \ + -thread_queue_size 4096 -f v4l2 -input_format mjpeg -framerate 30 \ + -video_size 640x480 -i /dev/video0 -an \ -c:v libx264 -preset veryfast -tune zerolatency -profile:v baseline -pix_fmt yuv420p \ - -b:v "$bitrate" -maxrate "$bitrate" -bufsize "$((bitrate / 2))" \ - -g "$fps" -keyint_min "$fps" -sc_threshold 0 -flush_packets 1 -muxdelay 0 -muxpreload 0 \ + -b:v 2000000 -maxrate 2000000 -bufsize 1000000 \ + -g 30 -keyint_min 30 -sc_threshold 0 -flush_packets 1 -muxdelay 0 -muxpreload 0 \ -f rtsp -rtsp_transport tcp "$ROVER_VIDEO_PUBLISH_URL" - id: rpicam name: Pi Zero 2 W Camera v2 (Carpet's Rovers) @@ -32,13 +21,9 @@ apt-get update && apt-get install -y ffmpeg rpicam-apps fi run: | - width=640 - height=480 - fps=30 - bitrate=2000000 rpicam-vid --inline --timeout 0 --rotation 180 --mode 1296:972 \ - --width "$width" --height "$height" \ - --framerate "$fps" --bitrate "$bitrate" \ + --width 640 --height 480 \ + --framerate 30 --bitrate 2000000 \ --codec h264 --intra 120 --profile baseline --denoise auto --nopreview \ --metering centre --ev 0.1 --awb auto --saturation 0.6 --brightness 0 --output - | ffmpeg -nostdin -hide_banner -loglevel warning -fflags nobuffer \