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
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
videoag
dominic_render_video
Commits
fead583c
Unverified
Commit
fead583c
authored
1 year ago
by
Dominic Meiser
Browse files
Options
Downloads
Patches
Plain Diff
only use av1 for >fhd videos
parent
3aeb9dd8
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/render/ffmpeg.rs
+1
-0
1 addition, 0 deletions
src/render/ffmpeg.rs
src/render/mod.rs
+28
-6
28 additions, 6 deletions
src/render/mod.rs
with
29 additions
and
6 deletions
src/render/ffmpeg.rs
+
1
−
0
View file @
fead583c
...
...
@@ -53,6 +53,7 @@ impl FfmpegInput {
}
}
#[derive(Clone,
Copy)]
pub
(
crate
)
enum
FfmpegOutputFormat
{
/// AV1 / FLAC
Av1Flac
,
...
...
This diff is collapsed.
Click to expand it.
src/render/mod.rs
+
28
−
6
View file @
fead583c
...
...
@@ -114,20 +114,23 @@ pub(crate) struct Renderer<'a> {
/// The slug (i.e. 23ws-malo2-231016).
slug
:
String
,
/// The target directory.
target
:
PathBuf
target
:
PathBuf
,
/// The format to use for intermediate products
format
:
FfmpegOutputFormat
}
fn
svg2mkv
(
meta
:
&
ProjectSourceMetadata
,
svg
:
PathBuf
,
mkv
:
PathBuf
,
format
:
FfmpegOutputFormat
,
duration
:
Time
)
->
anyhow
::
Result
<
()
>
{
let
mut
ffmpeg
=
Ffmpeg
::
new
(
FfmpegOutput
{
duration
:
Some
(
duration
),
time_base
:
Some
(
meta
.source_tbn
),
fps_mode_vfr
:
true
,
..
FfmpegOutput
::
new
(
FfmpegOutputFormat
::
Av1Flac
,
mkv
)
..
FfmpegOutput
::
new
(
format
,
mkv
)
});
ffmpeg
.add_input
(
FfmpegInput
{
loop_input
:
true
,
...
...
@@ -170,10 +173,29 @@ impl<'a> Renderer<'a> {
let
target
=
directory
.join
(
&
slug
);
fs
::
create_dir_all
(
&
target
)
?
;
let
first
:
PathBuf
=
directory
.join
(
project
.source
.files
.first
()
.context
(
"No source files present"
)
?
);
let
height
:
u32
=
ffprobe_video
(
"stream=height"
,
&
first
)
?
.split
(
'\n'
)
.next
()
.unwrap
()
.parse
()
?
;
let
format
=
if
height
<=
1080
{
FfmpegOutputFormat
::
AvcAac
}
else
{
FfmpegOutputFormat
::
Av1Flac
};
Ok
(
Self
{
directory
,
slug
,
target
target
,
format
})
}
...
...
@@ -244,7 +266,7 @@ impl<'a> Renderer<'a> {
.into_bytes
()
)
?
;
let
intro_mkv
=
self
.intro_mkv
();
svg2mkv
(
metadata
,
intro_svg
,
intro_mkv
,
INTRO_LEN
)
?
;
svg2mkv
(
metadata
,
intro_svg
,
intro_mkv
,
self
.format
,
INTRO_LEN
)
?
;
// render outro to svg then mp4
let
outro_svg
=
self
.target
.join
(
"outro.svg"
);
...
...
@@ -253,7 +275,7 @@ impl<'a> Renderer<'a> {
outro
(
source_res
)
.to_string_pretty
()
.into_bytes
()
)
?
;
let
outro_mkv
=
self
.outro_mkv
();
svg2mkv
(
metadata
,
outro_svg
,
outro_mkv
,
OUTRO_LEN
)
?
;
svg2mkv
(
metadata
,
outro_svg
,
outro_mkv
,
self
.format
,
OUTRO_LEN
)
?
;
// copy logo then render to png
let
logo_svg
=
self
.target
.join
(
"logo.svg"
);
...
...
@@ -305,7 +327,7 @@ impl<'a> Renderer<'a> {
let
output
=
self
.video_file_output
();
let
mut
ffmpeg
=
Ffmpeg
::
new
(
FfmpegOutput
{
video_bitrate
:
Some
(
source_res
.bitrate
()
*
3
),
..
FfmpegOutput
::
new
(
FfmpegOutputFormat
::
Av1Flac
,
output
.clone
())
..
FfmpegOutput
::
new
(
self
.format
,
output
.clone
())
});
// add all of our inputs
...
...
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