17 lines
466 B
Bash
17 lines
466 B
Bash
#!/usr/bin/env bash
|
|
cdir=$(pwd)
|
|
read -r INPUT
|
|
|
|
error() {
|
|
echo "{\"error\":\"$1\"}"
|
|
exit 0
|
|
}
|
|
|
|
video_file=$(echo "$INPUT" | jq -r '.video_file // empty')
|
|
[[ -z "$video_file" ]] && error "missing video_file"
|
|
[[ ! -f "$video_file" ]] && error "$video_file not exists"
|
|
|
|
ffmpeg -i $video_file -c:v copy -an output_video$$.mp4 -c:a pcm_s16le -f wav output_audio$$.wav
|
|
|
|
echo "{\"video_file\": \"$cdir/output_video$$.mp4\", \"audio_file\": \"$cdir/output_audio$$.wav\"}"
|