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
7662150b
Verified
Commit
7662150b
authored
Jun 26, 2024
by
Dominic Meiser
Browse files
Options
Downloads
Patches
Plain Diff
fix codec comparison; encode with higher quality for intermediate results
parent
b6fb0fa1
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/project.rs
+1
-1
1 addition, 1 deletion
src/project.rs
src/render/ffmpeg.rs
+24
-4
24 additions, 4 deletions
src/render/ffmpeg.rs
src/render/mod.rs
+2
-0
2 additions, 0 deletions
src/render/mod.rs
with
27 additions
and
5 deletions
src/project.rs
+
1
−
1
View file @
7662150b
...
@@ -51,7 +51,7 @@ impl Resolution {
...
@@ -51,7 +51,7 @@ impl Resolution {
}
}
pub
(
crate
)
fn
default_codec
(
self
)
->
FfmpegOutputFormat
{
pub
(
crate
)
fn
default_codec
(
self
)
->
FfmpegOutputFormat
{
if
self
.width
<=
1920
{
if
self
.width
>
1920
{
FfmpegOutputFormat
::
Av1Opus
FfmpegOutputFormat
::
Av1Opus
}
else
{
}
else
{
FfmpegOutputFormat
::
AvcAac
FfmpegOutputFormat
::
AvcAac
...
...
This diff is collapsed.
Click to expand it.
src/render/ffmpeg.rs
+
24
−
4
View file @
7662150b
...
@@ -63,8 +63,14 @@ pub(crate) enum FfmpegOutputFormat {
...
@@ -63,8 +63,14 @@ pub(crate) enum FfmpegOutputFormat {
AvcAac
AvcAac
}
}
pub
(
crate
)
enum
FfmpegOutputQuality
{
Default
,
VisuallyLossless
}
pub
(
crate
)
struct
FfmpegOutput
{
pub
(
crate
)
struct
FfmpegOutput
{
pub
(
crate
)
format
:
FfmpegOutputFormat
,
pub
(
crate
)
format
:
FfmpegOutputFormat
,
pub
(
crate
)
quality
:
FfmpegOutputQuality
,
pub
(
crate
)
audio_bitrate
:
Option
<
u64
>
,
pub
(
crate
)
audio_bitrate
:
Option
<
u64
>
,
pub
(
crate
)
video_bitrate
:
Option
<
u64
>
,
pub
(
crate
)
video_bitrate
:
Option
<
u64
>
,
...
@@ -89,6 +95,7 @@ impl FfmpegOutput {
...
@@ -89,6 +95,7 @@ impl FfmpegOutput {
pub
(
crate
)
fn
new
(
format
:
FfmpegOutputFormat
,
path
:
PathBuf
)
->
Self
{
pub
(
crate
)
fn
new
(
format
:
FfmpegOutputFormat
,
path
:
PathBuf
)
->
Self
{
Self
{
Self
{
format
,
format
,
quality
:
FfmpegOutputQuality
::
Default
,
audio_bitrate
:
None
,
audio_bitrate
:
None
,
video_bitrate
:
None
,
video_bitrate
:
None
,
...
@@ -117,7 +124,7 @@ impl FfmpegOutput {
...
@@ -117,7 +124,7 @@ impl FfmpegOutput {
self
self
}
}
fn
append_to_cmd
(
self
,
cmd
:
&
mut
Command
,
venc
:
bool
,
_aenc
:
bool
,
mut
vaapi
:
bool
)
{
fn
append_to_cmd
(
self
,
cmd
:
&
mut
Command
,
venc
:
bool
,
_aenc
:
bool
,
vaapi
:
bool
)
{
// select codec and bitrate/crf
// select codec and bitrate/crf
if
venc
{
if
venc
{
let
vcodec
=
match
(
self
.format
,
vaapi
)
{
let
vcodec
=
match
(
self
.format
,
vaapi
)
{
...
@@ -133,10 +140,23 @@ impl FfmpegOutput {
...
@@ -133,10 +140,23 @@ impl FfmpegOutput {
if
vcodec
==
"libsvtav1"
{
if
vcodec
==
"libsvtav1"
{
cmd
.arg
(
"-svtav1-params"
)
.arg
(
"fast-decode=1"
);
cmd
.arg
(
"-svtav1-params"
)
.arg
(
"fast-decode=1"
);
cmd
.arg
(
"-preset"
)
.arg
(
"7"
);
cmd
.arg
(
"-preset"
)
.arg
(
"7"
);
cmd
.arg
(
"-crf"
)
.arg
(
"28"
);
cmd
.arg
(
"-crf"
)
.arg
(
match
self
.quality
{
FfmpegOutputQuality
::
Default
=>
"28"
,
FfmpegOutputQuality
::
VisuallyLossless
=>
"18"
});
}
else
if
vcodec
==
"h264"
{
}
else
if
vcodec
==
"h264"
{
match
self
.quality
{
FfmpegOutputQuality
::
Default
=>
{
cmd
.arg
(
"-preset"
)
.arg
(
"slow"
);
cmd
.arg
(
"-preset"
)
.arg
(
"slow"
);
cmd
.arg
(
"-crf"
)
.arg
(
"21"
);
cmd
.arg
(
"-crf"
)
.arg
(
"21"
);
},
FfmpegOutputQuality
::
VisuallyLossless
=>
{
// the quality is not impacted by speed, only the bitrate, and
// for this setting we don't really care about bitrate
cmd
.arg
(
"-preset"
)
.arg
(
"veryfast"
);
cmd
.arg
(
"-crf"
)
.arg
(
"17"
);
}
}
}
else
if
let
Some
(
bv
)
=
self
.video_bitrate
{
}
else
if
let
Some
(
bv
)
=
self
.video_bitrate
{
cmd
.arg
(
"-b:v"
)
.arg
(
bv
.to_string
());
cmd
.arg
(
"-b:v"
)
.arg
(
bv
.to_string
());
}
}
...
...
This diff is collapsed.
Click to expand it.
src/render/mod.rs
+
2
−
0
View file @
7662150b
...
@@ -15,6 +15,7 @@ use crate::{
...
@@ -15,6 +15,7 @@ use crate::{
use
anyhow
::{
bail
,
Context
};
use
anyhow
::{
bail
,
Context
};
use
camino
::{
Utf8Path
as
Path
,
Utf8PathBuf
as
PathBuf
};
use
camino
::{
Utf8Path
as
Path
,
Utf8PathBuf
as
PathBuf
};
use
console
::
style
;
use
console
::
style
;
use
ffmpeg
::
FfmpegOutputQuality
;
use
std
::{
use
std
::{
borrow
::
Cow
,
borrow
::
Cow
,
collections
::
VecDeque
,
collections
::
VecDeque
,
...
@@ -377,6 +378,7 @@ impl<'a> Renderer<'a> {
...
@@ -377,6 +378,7 @@ impl<'a> Renderer<'a> {
let
output
=
self
.video_file_output
();
let
output
=
self
.video_file_output
();
let
mut
ffmpeg
=
Ffmpeg
::
new
(
FfmpegOutput
{
let
mut
ffmpeg
=
Ffmpeg
::
new
(
FfmpegOutput
{
quality
:
FfmpegOutputQuality
::
VisuallyLossless
,
video_bitrate
:
Some
(
source_res
.bitrate
()
*
3
),
video_bitrate
:
Some
(
source_res
.bitrate
()
*
3
),
..
FfmpegOutput
::
new
(
self
.format
,
output
.clone
())
..
FfmpegOutput
::
new
(
self
.format
,
output
.clone
())
});
});
...
...
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