Check if input file is valid video before attempting to encode - bitreich-tv - Meme TV encoding and streaming
(HTM) git clone git://bitreich.org/bitreich-tv git://enlrupgkhuxnvlhsf6lc3fziv5h2hhfrinws65d7roiv6bfj7d652fid.onion/bitreich-tv
(DIR) Log
(DIR) Files
(DIR) Refs
(DIR) Tags
(DIR) LICENSE
---
(DIR) commit 6f3514847865e21a214ade45b3c8c01cf9cda678
(DIR) parent beded2279cdfa35a7d896bfa5729b2dbddec92c6
(HTM) Author: Anders Damsgaard <anders@adamsgaard.dk>
Date: Thu, 13 Aug 2020 10:08:07 +0200
Check if input file is valid video before attempting to encode
Diffstat:
M brtv-start.sh | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
---
(DIR) diff --git a/brtv-start.sh b/brtv-start.sh
@@ -86,7 +86,10 @@ title_slide() {
video_conv() {
printf 'encode %s -> %s\n' "$1" "$2"
- ffmpeg -y -i "$1" $ffmpeg_codec -max_muxing_queue_size 1024 "$2"
+ if ! regeximatch "$(file -ib "$f")" "^video\/"; then
+ die "input video $1 is invalid ($(file -b "$1"))"
+ fi
+ ffmpeg -y -i "$1" $ffmpeg_codec "$2"
}
mkdir -p "$title"