Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
osak
materials
Commits
b32d635a
Commit
b32d635a
authored
Apr 17, 2012
by
Milan Santosi
Browse files
why not learn something and try to do it right?
Signed-off-by:
Milan Santosi
<
milan.santosi@gmail.com
>
parent
b6182e9c
Changes
1
Hide whitespace changes
Inline
Side-by-side
kiss/ffmpeg_splitter.sh
View file @
b32d635a
#!/bin/bash
#
very
dirty script to split a video into 15 minutes parts with ten
# dirty
little
script to split a video into 15 minutes parts with ten
# seconds overlap (for upload to youtube)
# USAGE: read comments and adjust where necessary, then:
...
...
@@ -15,10 +15,23 @@ bname=${fname%%.*} # the file basename
ext
=
${
fname
#*.
}
# the file extension
for
i
in
{
1..5
}
# Naive assumption that no video is longer than
# 5*15=75min. Please adjust!
do
ffmpeg
-vcodec
copy
-acodec
copy
-ss
$[
i
*
890 - 890]
-t
899.999
-i
$1
$bname
-part0
$i
.
$ext
done
# to avoid async a/v, re-encode with every frame as keyframe
if
test
-f
$bname
-keyframes
.
$ext
then
:
else
ffmpeg
-g
1
-i
$1
$bname
-keyframes
.
$ext
fi
# get length and calculate amount of segments
let
vidlen
=
$(
ffprobe
-show_format
$1
|
grep
duration |
cut
-d
"."
-f
1 |
cut
-d
"="
-f
2
)
+1
let
segcount
=
$vidlen
/890
# loop until it's done
for
((
i
=
1
;
i <
=
$segcount
;
i++
))
do
ffmpeg
-vcodec
copy
-acodec
copy
-ss
$[
i
*
890 - 890]
-t
899.999
-i
$bname
-keyframes
.
$ext
$bname
-part0
$i
.
$ext
done
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment