Skip to content

Commit

Permalink
fix ebur128 logging, specified bitrate
Browse files Browse the repository at this point in the history
reduce ebur128 log messages
fix bug overwriting user-specified bitrate with default
  • Loading branch information
hydra3333 authored Jun 24, 2023
1 parent 6a06884 commit 1abd150
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
4 changes: 2 additions & 2 deletions slideshow_CONTROLLER.py
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ def audio_standardize_and_import_file(audio_filename, headroom_db, ignore_error_
stats = r'-stats'
benchmark = r'-benchmark'
else:
loglevel = 'info'
loglevel = 'warning'
stats = r'-nostats'
benchmark = stats # a hack to workaround ffmpeg rejecting zero length string''

Expand All @@ -354,7 +354,7 @@ def audio_standardize_and_import_file(audio_filename, headroom_db, ignore_error_
'-threads', str(UTIL.NUM_THREADS_FOR_FFMPEG_DECODER),
'-i', audio_filename,
'-vn',
'-af', f'ebur128=peak=true:target={headroom_db}:dualmono=true', # this normalizes audio using industry standard ebur128; ffmpeg takes a while and it may not even work
'-af', f'ebur128=peak=true:target={headroom_db}:dualmono=true:framelog=quiet', # this normalizes audio using industry standard ebur128; ffmpeg takes a while and it may not even work
'-acodec', temporary_background_audio_codec,
'-threads', str(UTIL.NUM_THREADS_FOR_FFMPEG_ENCODER),
'-ac', str(target_background_audio_channels),
Expand Down
12 changes: 9 additions & 3 deletions slideshow_LOAD_SETTINGS.py
Original file line number Diff line number Diff line change
Expand Up @@ -561,20 +561,26 @@ def load_settings():
TARGET_RESOLUTION = list(valid_TARGET_RESOLUTION.keys())[0] # the first key in that dict
TARGET_WIDTH = valid_TARGET_RESOLUTION[TARGET_RESOLUTION]['WIDTH']
TARGET_HEIGHT = valid_TARGET_RESOLUTION[TARGET_RESOLUTION]['HEIGHT']
TARGET_VIDEO_BITRATE = valid_TARGET_RESOLUTION[TARGET_RESOLUTION]['BITRATE']
TARGET_FPSNUM = valid_TARGET_RESOLUTION[TARGET_RESOLUTION]['FRAMERATE_NUMERATOR']
TARGET_FPSDEN = valid_TARGET_RESOLUTION[TARGET_RESOLUTION]['FRAMERATE_DENOMINATOR']
TARGET_VIDEO_BITRATE = valid_TARGET_RESOLUTION[TARGET_RESOLUTION]['BITRATE']

print(f'load_settings: WARNING: TARGET_RESOLUTION "{final_settings_dict["TARGET_RESOLUTION"]}" not one of {valid_TARGET_RESOLUTION}, resetting to "{TARGET_RESOLUTION}"',flush=True,file=sys.stderr)
final_settings_dict['TARGET_RESOLUTION'] = TARGET_RESOLUTION

TARGET_RESOLUTION = final_settings_dict['TARGET_RESOLUTION'] # grab the specified TARGET_RESOLUTION
TARGET_WIDTH = valid_TARGET_RESOLUTION[TARGET_RESOLUTION]['WIDTH'] # based on specified TARGET_RESOLUTION
TARGET_HEIGHT = valid_TARGET_RESOLUTION[TARGET_RESOLUTION]['HEIGHT'] # based on specified TARGET_RESOLUTION
TARGET_VIDEO_BITRATE = valid_TARGET_RESOLUTION[TARGET_RESOLUTION]['BITRATE'] # based on specified TARGET_RESOLUTION
TARGET_FPSNUM = valid_TARGET_RESOLUTION[TARGET_RESOLUTION]['FRAMERATE_NUMERATOR']
TARGET_FPSDEN = valid_TARGET_RESOLUTION[TARGET_RESOLUTION]['FRAMERATE_DENOMINATOR']
TARGET_VIDEO_BITRATE = final_settings_dict['TARGET_VIDEO_BITRATE'] # based on specified TARGET_RESOLUTION, allow user to change it

final_settings_dict['TARGET_RESOLUTION'] = TARGET_RESOLUTION
final_settings_dict['TARGET_WIDTH'] = TARGET_WIDTH # poke back the right value based on specified TARGET_RESOLUTION
final_settings_dict['TARGET_HEIGHT'] = TARGET_HEIGHT # poke back the right value based on specified TARGET_RESOLUTION
final_settings_dict['TARGET_VIDEO_BITRATE'] = TARGET_VIDEO_BITRATE # poke back the right value based on specified TARGET_RESOLUTION
final_settings_dict['TARGET_FPSNUM'] = TARGET_FPSNUM # poke back the right value based on specified TARGET_RESOLUTION
final_settings_dict['TARGET_FPSDEN'] = TARGET_FPSDEN # poke back the right value based on specified TARGET_RESOLUTION
final_settings_dict['TARGET_VIDEO_BITRATE'] = TARGET_VIDEO_BITRATE # poke back the right value based on specified TARGET_RESOLUTION

if final_settings_dict['SORT_TYPE'].lower() not in valid_SORT_TYPES:
print(f'load_settings: WARNING: SORT_TYPE "{final_settings_dict["SORT_TYPE"]}" not one of {valid_SORT_TYPES}, defaulting to "{SORT_TYPE}"',flush=True,file=sys.stderr)
Expand Down

0 comments on commit 1abd150

Please sign in to comment.