Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2142 from pypeclub/feature/burnin_dnxhd_profiles_…
Browse files Browse the repository at this point in the history
…handling

Burnins: DNxHD profiles handling
  • Loading branch information
iLLiCiTiT authored Oct 18, 2021
2 parents 7c2da65 + c2e22ba commit 3c1b04a
Showing 1 changed file with 31 additions and 3 deletions.
34 changes: 31 additions & 3 deletions openpype/scripts/otio_burnin.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,9 +109,7 @@ def _prores_codec_args(ffprobe_data, source_ffmpeg_cmd):


def _h264_codec_args(ffprobe_data, source_ffmpeg_cmd):
output = []

output.extend(["-codec:v", "h264"])
output = ["-codec:v", "h264"]

# Use arguments from source if are available source arguments
if source_ffmpeg_cmd:
Expand All @@ -137,6 +135,32 @@ def _h264_codec_args(ffprobe_data, source_ffmpeg_cmd):
return output


def _dnxhd_codec_args(ffprobe_data, source_ffmpeg_cmd):
output = ["-codec:v", "dnxhd"]

# Use source profile (profiles in metadata are not usable in args directly)
profile = ffprobe_data.get("profile") or ""
# Lower profile and replace space with underscore
cleaned_profile = profile.lower().replace(" ", "_")
dnx_profiles = {
"dnxhd",
"dnxhr_lb",
"dnxhr_sq",
"dnxhr_hq",
"dnxhr_hqx",
"dnxhr_444"
}
if cleaned_profile in dnx_profiles:
output.extend(["-profile:v", cleaned_profile])

pix_fmt = ffprobe_data.get("pix_fmt")
if pix_fmt:
output.extend(["-pix_fmt", pix_fmt])

output.extend(["-g", "1"])
return output


def get_codec_args(ffprobe_data, source_ffmpeg_cmd):
codec_name = ffprobe_data.get("codec_name")
# Codec "prores"
Expand All @@ -147,6 +171,10 @@ def get_codec_args(ffprobe_data, source_ffmpeg_cmd):
if codec_name == "h264":
return _h264_codec_args(ffprobe_data, source_ffmpeg_cmd)

# Coded DNxHD
if codec_name == "dnxhd":
return _dnxhd_codec_args(ffprobe_data, source_ffmpeg_cmd)

output = []
if codec_name:
output.extend(["-codec:v", codec_name])
Expand Down

0 comments on commit 3c1b04a

Please sign in to comment.