-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* test: attempt to trim videos using GPU acceleration * fix: fixed the ffmpeg preset issue between ffmpeg and nvenc codex --------- Co-authored-by: Hanxiong Shi <[email protected]>
- Loading branch information
1 parent
0586e01
commit fd5d19d
Showing
5 changed files
with
88 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
### v1.6.1 | ||
|
||
- adjusted segment modal size | ||
- ffmpeg now uses GPU acceleration instead of CPU | ||
|
||
### v1.6.0 | ||
|
||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from video_utils import VideoUtils | ||
|
||
|
||
def test_get_ffmpeg_preset_value_for_nvenc_h264(): | ||
assert VideoUtils.get_ffmpeg_preset_value_for_nvenc_h264("faster") == "fast" | ||
assert VideoUtils.get_ffmpeg_preset_value_for_nvenc_h264("veryslow") == "slow" | ||
assert VideoUtils.get_ffmpeg_preset_value_for_nvenc_h264("medium") == "medium" | ||
assert ( | ||
VideoUtils.get_ffmpeg_preset_value_for_nvenc_h264("not-a-valie-preset") | ||
== "medium" | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
class VideoUtils: | ||
def __init__(self): | ||
pass | ||
|
||
@staticmethod | ||
def get_ffmpeg_preset_value_for_nvenc_h264(ffmpeg_preset_value): | ||
""" | ||
this method is used to translate FFMPEG presets into nvenc encoder presets | ||
when using CPU encoding, ffmpeg allows presets to be: | ||
'ultrafast', 'superfast', 'veryfast', 'faster', 'fast', 'medium', 'slow', 'slower', 'veryslow' | ||
when using GPU encoding, ffmpeg nvenc_h264 allows presets to be: | ||
'slow', 'medium', 'fast' | ||
""" | ||
if ( | ||
ffmpeg_preset_value == "ultrafast" | ||
or ffmpeg_preset_value == "superfast" | ||
or ffmpeg_preset_value == "veryfast" | ||
or ffmpeg_preset_value == "faster" | ||
or ffmpeg_preset_value == "fast" | ||
): | ||
return "fast" | ||
elif ( | ||
ffmpeg_preset_value == "slow" | ||
or ffmpeg_preset_value == "slower" | ||
or ffmpeg_preset_value == "veryslow" | ||
): | ||
return "slow" | ||
else: | ||
return "medium" |