Skip to content

Commit

Permalink
Fix AMD hardware HEVC
Browse files Browse the repository at this point in the history
  • Loading branch information
varnav committed Jul 17, 2023
1 parent f97b7f1 commit c47645e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ You can download and use it as single Windows binary, see [Releases](https://git
Unfortunately antiviruses [don't like packed Python executables](https://github.com/pyinstaller/pyinstaller/issues?q=is%3Aissue+virus), so expect false positives from them if you go this way. Best way is pip.

You will need [ffmpeg binaries](https://www.gyan.dev/ffmpeg/builds/) in path. It's best to
extract 3 exe files from [archive](https://www.gyan.dev/ffmpeg/builds/ffmpeg-git-essentials.7z) to `%USERPROFILE%\AppData\Local\Microsoft\WindowsApps`
extract 3 exe files from [archive](https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-5.1.2-full_build.7z) to `%USERPROFILE%\AppData\Local\Microsoft\WindowsApps`

Example use with nVidia hardware encoding:

Expand Down
6 changes: 3 additions & 3 deletions filmcompress.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,16 @@ def main(indir, av1, outdir=None, oformat='mp4', include='*', recursive=False, o
if os.path.exists(new_fp):
print(colored(str(new_fp) + ' exists', 'yellow'))
continue
if os.name == 'nt' and gpu == 'nvidia':
if gpu == 'nvidia':
print(colored('Encoding with nVidia hardware acceleration', 'yellow'))
# https://slhck.info/video/2017/03/01/rate-control.html
# https://docs.nvidia.com/video-technologies/video-codec-sdk/ffmpeg-with-nvidia-gpu/
# ffmpeg -h encoder=hevc_nvenc
#print(ffmpeg.input(fp).output(str(new_fp), acodec='copy', map=0, vcodec='hevc_nvenc', **{'rc-lookahead': 25}, map_metadata=0, movflags='use_metadata_tags', preset='p6', spatial_aq=1, temporal_aq=1).run())
print(ffmpeg.input(fp).output(str(new_fp), vcodec='hevc_nvenc', **{'rc-lookahead': 25}, map_metadata=0, movflags='use_metadata_tags', preset='p6', spatial_aq=1, temporal_aq=1).run())
if os.name == 'nt' and gpu == 'amd':
if gpu == 'amd':
print(colored('Encoding with AMD hardware acceleration', 'red'))
print(ffmpeg.input(fp).output(str(new_fp), vcodec='hevc_amf', map_metadata=0, movflags='use_metadata_tags', quality='balanced', usage='high_quality').run())
print(ffmpeg.input(fp).output(str(new_fp), vcodec='hevc_amf', map_metadata=0, movflags='use_metadata_tags', quality='balanced', usage='lowlatency', rc="cqp").run())
elif av1:
# ffmpeg -h encoder=libaom-av1
print(colored('Encoding with experimental AV1 encoder', 'yellow'))
Expand Down

0 comments on commit c47645e

Please sign in to comment.