diff --git a/capture_video.sh b/capture_video.sh index d5dbba4..7932589 100755 --- a/capture_video.sh +++ b/capture_video.sh @@ -1,13 +1,14 @@ #!/bin/bash if [[ "$1" == *help ]]; then - echo "Usage: ${0} [-duration 10] [-sound plughw:1,0]" - echo "default duration (in seconds) is infinite" - echo "default sound is anullsrc i.e. silent sound" + echo "Example usage: ${0} [-duration 10] [-sound plughw:1,0]" + echo "optional -duration is in seconds" + echo "optional -sound values: [none, anullsrc, plughw:1,0]" + echo "default -sound is none i.e. no sound" exit 1 fi -# available options +# available options # 640x480/60 # 1296x972/43 # 1920x1080/30 @@ -25,7 +26,7 @@ VIDEO_RES_WIDTH="640" VIDEO_FRAMERATE="10" VIDEO_FILE="camera_$(date +%Y-%m-%d_%H-%M-%S).mp4" VIDEO_DURATION="1000000000" -SOUND_SOURCE="anullsrc" +SOUND_SOURCE="none" while [[ $# -gt 0 ]]; do case $1 in @@ -72,7 +73,17 @@ rpicam-vid --inline \ -b ${VIDEO_BITRATE} \ -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 -hide_banner \ -f lavfi \