|
- #!/bin/bash
- #
- # Add a silent audio track to a video asset
- #
- # Usage:
- #
- # jaddsilence [-n|--no-exec] in-file out-file [channel-mode] [sampling-rate]
- #
- # -n or --no-exec : if set, do not execute ffmpeg but print what would have run
- # in-file : input video file
- # out-file : write output file here
- # channel-mode : channel layout, usually 'mono' or 'stereo'. Default is stereo
- # sampling-rate : sampling rate, in Hz. Default is 48000
- #
- SCRIPT="${0}"
- SCRIPT_DIR="$(cd "$(dirname "${SCRIPT}")" && pwd)"
- . "${SCRIPT_DIR}"/jvc_common
-
- IN_FILE="${1?no video-file provided}"
- OUT_FILE="${2?no out-file provided}"
- CHANNEL_LAYOUT="${3}"
- SAMPLING_RATE="${4}"
-
- echo "
- {
- \"assets\": [
- { \"name\": \"input\", \"path\": \"${IN_FILE}\" }
- ],
- \"operations\": [
- {
- \"operation\": \"add-silence\",
- \"creates\": {
- \"name\": \"with_silence\",
- \"dest\": \"${OUT_FILE}\"
- },
- \"source\": \"input\"$(if [[ -n "${CHANNEL_LAYOUT}" ]] ; then echo ",
- \"channelLayout\": \"${CHANNEL_LAYOUT}\"" ; fi)$(if [[ -n "${SAMPLING_RATE}" ]] ; then echo ",
- \"samplingRate: \"${SAMPLING_RATE}\"" ; fi)
- }
- ]
- }
- " | "${SCRIPT_DIR}"/jvc ${JVC_OPTIONS}
|