Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dominic_render_video
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
videoag
dominic_render_video
Commits
e36f13f1
Unverified
Commit
e36f13f1
authored
Oct 30, 2023
by
Dominic Meiser
Browse files
Options
Downloads
Patches
Plain Diff
add ff support to rendering
parent
4efbe0c4
No related branches found
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/render/filter.rs
+16
-8
16 additions, 8 deletions
src/render/filter.rs
src/render/mod.rs
+17
-10
17 additions, 10 deletions
src/render/mod.rs
src/time.rs
+1
-1
1 addition, 1 deletion
src/time.rs
with
34 additions
and
19 deletions
src/render/filter.rs
+
16
−
8
View file @
e36f13f1
...
...
@@ -220,10 +220,10 @@ impl Filter {
writeln!
(
complex
,
"{}asplit=3{}{}{};"
,
channel
(
'
v
'
,
input
),
v
in
[
0
],
v
in
[
1
],
v
in
[
2
]
channel
(
'
a
'
,
input
),
a
in
[
0
],
a
in
[
1
],
a
in
[
2
]
);
// next we cut those audio/videos into before, ff, after
...
...
@@ -233,16 +233,24 @@ impl Filter {
writeln!
(
complex
,
"{}atrim=duration={start}{};"
,
ain
[
0
],
acut
[
0
]);
writeln!
(
complex
,
"{}trim=start={start}:duration={duration}{};"
,
"{}trim=start={start}:duration={duration}
,setpts=PTS-STARTPTS
{};"
,
vin
[
1
],
vcut
[
1
]
);
writeln!
(
complex
,
"{}atrim=start={start}:duration={duration}{};"
,
"{}atrim=start={start}:duration={duration}
,asetpts=PTS-STARTPTS
{};"
,
ain
[
1
],
acut
[
1
]
);
writeln!
(
complex
,
"{}trim=start={end}{};"
,
vin
[
2
],
vcut
[
2
]);
writeln!
(
complex
,
"{}atrim=start={end}{};"
,
ain
[
2
],
acut
[
2
]);
writeln!
(
complex
,
"{}trim=start={end},setpts=PTS-STARTPTS{};"
,
vin
[
2
],
vcut
[
2
]
);
writeln!
(
complex
,
"{}atrim=start={end},asetpts=PTS-STARTPTS{};"
,
ain
[
2
],
acut
[
2
]
);
// now we speed up the ff part
let
vff
=
next_tmp
(
filter_idx
);
...
...
This diff is collapsed.
Click to expand it.
src/render/mod.rs
+
17
−
10
View file @
e36f13f1
...
...
@@ -28,11 +28,11 @@ const OUTRO_LEN: Time = Time {
seconds
:
5
,
micros
:
0
};
const
TRANSITION
:
&
str
=
"fadeblack"
;
const
TRANSITION_LEN
:
Time
=
Time
{
seconds
:
0
,
micros
:
200_000
};
const
FF_MULTIPLIER
:
usize
=
3
;
fn
cmd
()
->
Command
{
let
mut
cmd
=
Command
::
new
(
"busybox"
);
...
...
@@ -208,10 +208,7 @@ impl<'a> Renderer<'a> {
.into_bytes
()
)
?
;
let
intro_mp4
=
self
.target
.join
(
"intro.mp4"
);
svg2mp4
(
intro_svg
,
intro_mp4
,
Time
{
seconds
:
3
,
micros
:
0
})
?
;
svg2mp4
(
intro_svg
,
intro_mp4
,
INTRO_LEN
)
?
;
// render outro to svg then mp4
let
outro_svg
=
self
.target
.join
(
"outro.svg"
);
...
...
@@ -220,10 +217,7 @@ impl<'a> Renderer<'a> {
outro
(
source_res
)
.to_string_pretty
()
.into_bytes
()
)
?
;
let
outro_mp4
=
self
.target
.join
(
"outro.mp4"
);
svg2mp4
(
outro_svg
,
outro_mp4
,
Time
{
seconds
:
5
,
micros
:
0
})
?
;
svg2mp4
(
outro_svg
,
outro_mp4
,
OUTRO_LEN
)
?
;
// copy logo then render to png
let
logo_svg
=
self
.target
.join
(
"logo.svg"
);
...
...
@@ -284,7 +278,20 @@ impl<'a> Renderer<'a> {
});
part2
=
rectrim
.into
();
// TODO ff
// fast-forward the requested parts in reverse order
project
.source.fast
.sort
();
for
(
i
,
(
ff_st
,
ff_end
))
in
project
.source.fast
.iter
()
.rev
()
.enumerate
()
{
let
recff
=
format!
(
"recff{i}"
);
ffmpeg
.add_filter
(
Filter
::
FastForward
{
input
:
part2
,
ffinput
:
ff
.clone
()
.into
(),
start
:
*
ff_st
-
start
,
duration
:
*
ff_end
-
*
ff_st
,
multiplier
:
FF_MULTIPLIER
,
output
:
recff
.clone
()
.into
()
});
part2
=
recff
.into
();
}
// TODO fade
...
...
This diff is collapsed.
Click to expand it.
src/time.rs
+
1
−
1
View file @
e36f13f1
...
...
@@ -77,7 +77,7 @@ pub fn format_date_long(d: Date) -> String {
format!
(
"{:02}. {month} {:04}"
,
d
.day
,
d
.year
)
}
#[derive(Clone,
Copy,
Debug,
Eq,
PartialEq)]
#[derive(Clone,
Copy,
Debug,
Eq,
PartialEq
,
PartialOrd,
Ord
)]
pub
struct
Time
{
pub
seconds
:
u32
,
pub
micros
:
u32
...
...
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