Skip to content

Commit

Permalink
Will now properly get audio delay from mp4 files
Browse files Browse the repository at this point in the history
- Fixes #30
  • Loading branch information
jessielw committed Jan 11, 2023
1 parent 8722b20 commit ec0c7d9
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions FFMPEGAudioEncoder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1813,10 +1813,16 @@ def close_audio_cancel(): # Function is used when 'Cancel' is clicked
audio_window.destroy()

try:
if track_selection_mediainfo.delay_relative_to_video is not None:
delay_string = f"[delay {str(track_selection_mediainfo.delay_relative_to_video)}ms]"
if "mp4" in str(pathlib.Path(file_input).suffix):
if track_selection_mediainfo.source_delay:
delay_string = f"[delay {str(track_selection_mediainfo.source_delay)}ms]"
else:
delay_string = str("[delay 0ms]")
else:
delay_string = str("[delay 0ms]")
if track_selection_mediainfo.delay_relative_to_video is not None:
delay_string = f"[delay {str(track_selection_mediainfo.delay_relative_to_video)}ms]"
else:
delay_string = str("[delay 0ms]")
except UnboundLocalError:
pass

Expand Down Expand Up @@ -11301,11 +11307,17 @@ def thread_adding_to_manager():
general_track.count_of_menu_streams
) # check for menu track(s)

try: # set delay string for file output name
if track_selection_mediainfo.delay_relative_to_video is not None:
delay_string = f"[delay {str(track_selection_mediainfo.delay_relative_to_video)}ms]"
try:
if "mp4" in str(pathlib.Path(batch_file).suffix):
if track_selection_mediainfo.source_delay:
delay_string = f"[delay {str(track_selection_mediainfo.source_delay)}ms]"
else:
delay_string = str("[delay 0ms]")
else:
delay_string = str("[delay 0ms]")
if track_selection_mediainfo.delay_relative_to_video is not None:
delay_string = f"[delay {str(track_selection_mediainfo.delay_relative_to_video)}ms]"
else:
delay_string = str("[delay 0ms]")
except UnboundLocalError:
pass

Expand Down

0 comments on commit ec0c7d9

Please sign in to comment.