Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
small-scripts
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Isabella Skořepová
small-scripts
Commits
517512a6
Commit
517512a6
authored
9 years ago
by
Isabella Skořepová
Browse files
Options
Downloads
Patches
Plain Diff
Quiet lvl 1 and file read
parent
3db2734f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
ffmpegsplit
+60
-7
60 additions, 7 deletions
ffmpegsplit
with
60 additions
and
7 deletions
ffmpegsplit
+
60
−
7
View file @
517512a6
...
...
@@ -9,7 +9,7 @@ version() {
display_help
()
{
cat
<<
EOH
Usage:
$0
[options] VIDEO-FILE TIMES-FILE
$0
[options]
-i
VIDEO-FILE
-t
TIMES-FILE
Video file will be split into parts at times specified in times-file
...
...
@@ -20,10 +20,12 @@ Empty lines (except for trailing) will confuse this script
(Not implemented options are marked with !)
Options:
!
-q --quiet Surpresses ffmpeg output. Put twice to surpress all output
!
-d --debug Do not invoke ffmpeg and only show commands to run
-q --quiet Surpresses ffmpeg output. Put twice to surpress all output
-d --debug Do not invoke ffmpeg and only show commands to run
-v --version Shows version information
-h --help Shows this help message
-i --input Input video file (required)
-t --times Input times file (required)
Written by Jakub Skořepa (jakub at skorepa.info) in 2015-4
Distributed under:
...
...
@@ -49,6 +51,14 @@ do
display_help
exit
;;
-i
|
--input
)
file
=
"
$2
"
shift
;;
-t
|
--times
)
lengths
=
"
$2
"
shift
;;
*
)
echo
"Warning: unknown option
$key
"
;;
...
...
@@ -56,10 +66,37 @@ do
shift
done
exit
if
[
-z
"
$file
"
]
&&
[
-z
"
$lengths
"
]
then
echo
"File and times file was not specified"
echo
"See
$0
--help for more information"
exit
fi
if
[
-z
"
$file
"
]
then
echo
"File was not specified"
echo
"See
$0
--help for more information"
exit
fi
if
[
-z
"
$lengths
"
]
then
echo
"Times file was not specified"
echo
"See
$0
--help for more information"
exit
fi
echo
"ffmpeg -i
\"
$file
\"
-to "
$(
sed
"1q;d"
$lengths
)
" 1.mp4"
ffmpeg
-i
"
$file
"
-to
$(
sed
"1q;d"
$lengths
)
1.mp4
if
[
!
$debug
]
then
if
[
$quiet
-ge
1
]
then
ffmpeg
-i
"
$file
"
-to
$(
sed
"1q;d"
$lengths
)
1.mp4
>
/dev/null 2>&1
else
ffmpeg
-i
"
$file
"
-to
$(
sed
"1q;d"
$lengths
)
1.mp4
fi
fi
N
=
$(
cat
"
$lengths
"
|
wc
-l
)
Nm
=
$[
N-1]
for
I
in
$(
eval echo
"{1..
$Nm
}"
)
...
...
@@ -69,8 +106,24 @@ do
t0
=
$[
t-10]
# start time - 10
t1
=
$[
t2-t0]
# length of segment + 10
echo
"ffmpeg -ss
$t0
-i
\"
$file
\"
-ss 10 -to
$t1
$I
.mp4"
ffmpeg
-ss
$t0
-i
"
$file
"
-ss
10
-to
$t1
"
$I
"".mp4"
if
[
!
$debug
]
then
if
[
$quiet
-ge
1
]
then
ffmpeg
-ss
$t0
-i
"
$file
"
-ss
10
-to
$t1
"
$I
"".mp4"
>
/dev/null 2>&1
else
ffmpeg
-ss
$t0
-i
"
$file
"
-ss
10
-to
$t1
"
$I
"".mp4"
fi
fi
done
t
=
$(
sed
"
$N
""q;d"
"
$lengths
"
)
echo
"ffmpeg -ss "
$[
t-10]
" -i
\"
$file
\"
-ss 10
$N
.mp4"
ffmpeg
-ss
$[
t-10]
-i
"
$file
"
-ss
10
"
$N
"".mp4"
if
[
!
debug
]
then
if
[
$quiet
-ge
1
]
then
ffmpeg
-ss
$[
t-10]
-i
"
$file
"
-ss
10
"
$N
"".mp4"
>
/dev/null 2>&1
else
ffmpeg
-ss
$[
t-10]
-i
"
$file
"
-ss
10
"
$N
"".mp4"
fi
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment