I'm writing a script to split a video in multiple small files based on subtitles timing. Each chunk illustrated how to sign a word LSF (French Sign Language).
However, some file are blank once extracted and when converted to webm
they are 0kb
.
Timing data
I extract the timing from a .ass
file to get this kind of file
0:00:01.01 0:00:04.07
0:00:04.09 0:00:07.00
0:00:07.00 0:00:10.36
0:00:10.36 0:00:13.28
First column is start_time
, second is end_time
Extraction
extract_word_chunk() {
ffmpeg \
-i "$INPUT_FILE" \
-ss "$start" \
-to "$end" \
-vcodec copy \
-acodec copy \
-loglevel error \
"$chunk" < /dev/null
}
Conversion to webm
convert_to_webm() {
ffmpeg \
-y \
-i "$chunk" \
-acodec libvorbis \
-codec:v libvpx \
-b:v 192k \
-b:a 96k \
-minrate 128k \
-maxrate 256k \
-bufsize 192k \
-quality good \
-cpu-used 2 \
-deadline best \
-loglevel error \
"$chunk.webm" < /dev/null
}
Output
# extract_word_chunk
ffmpeg \
-i 'assets/raw/partie 1: Apprendre 300 mots du quotidien en LSF.jauvert laura.mkv' \
-ss 0:00:01.01 \
-to 0:00:04.07 \
-vcodec copy \
-acodec copy \
-loglevel error \
assets/raw/0:00:01.01.mkv
# convert_to_webm
ffmpeg -y \
-i assets/raw/0:00:01.01.mkv \
-acodec libvorbis \
-codec:v libvpx \
-b:v 192k \
-b:a 96k \
-minrate 128k \
-maxrate 256k \
-bufsize 192k \
-quality good \
-cpu-used 2 \
-deadline best \
-loglevel error \
assets/raw/0:00:01.01.mkv.webm
Error
[buffer @ 0x16d8be0] Unable to parse option value "-1" as pixel format
Last message repeated 1 times
[buffer @ 0x16d8be0] Error setting option pix_fmt to value -1.
[graph 0 input from stream 0:0 @ 0x16e6fc0] Error applying options to the filter.
Question
Only some chunk are blank/empty.
How do I prevent my video to be blank/empty?