added no sound

This commit is contained in:
cpu
2024-02-07 13:35:09 +01:00
parent 09d04489cf
commit 86abce9a1a

View File

@@ -1,13 +1,14 @@
#!/bin/bash #!/bin/bash
if [[ "$1" == *help ]]; then if [[ "$1" == *help ]]; then
echo "Usage: ${0} [-duration 10] [-sound plughw:1,0]" echo "Example usage: ${0} [-duration 10] [-sound plughw:1,0]"
echo "default duration (in seconds) is infinite" echo "optional -duration is in seconds"
echo "default sound is anullsrc i.e. silent sound" echo "optional -sound values: [none, anullsrc, plughw:1,0]"
echo "default -sound is none i.e. no sound"
exit 1 exit 1
fi fi
# available options
# available options
# 640x480/60 # 640x480/60
# 1296x972/43 # 1296x972/43
# 1920x1080/30 # 1920x1080/30
@@ -25,7 +26,7 @@ VIDEO_RES_WIDTH="640"
VIDEO_FRAMERATE="10" VIDEO_FRAMERATE="10"
VIDEO_FILE="camera_$(date +%Y-%m-%d_%H-%M-%S).mp4" VIDEO_FILE="camera_$(date +%Y-%m-%d_%H-%M-%S).mp4"
VIDEO_DURATION="1000000000" VIDEO_DURATION="1000000000"
SOUND_SOURCE="anullsrc" SOUND_SOURCE="none"
while [[ $# -gt 0 ]]; do while [[ $# -gt 0 ]]; do
case $1 in case $1 in
@@ -72,7 +73,17 @@ rpicam-vid --inline \
-b ${VIDEO_BITRATE} \ -b ${VIDEO_BITRATE} \
-o - | \ -o - | \
if [ "${SOUND_SOURCE}" = "anullsrc" ]; then if [ "${SOUND_SOURCE}" = "none" ]; then
# ffmpeg params without audio
ffmpeg -hide_banner \
-thread_queue_size 1024 \
-use_wallclock_as_timestamps 1 \
-i pipe:0 \
-c:v copy \
-f mp4 \
-t ${VIDEO_DURATION} \
${VIDEO_FILE} &
elif [ "${SOUND_SOURCE}" = "anullsrc" ]; then
# ffmpeg params with silent audio # ffmpeg params with silent audio
ffmpeg -hide_banner \ ffmpeg -hide_banner \
-f lavfi \ -f lavfi \