Skip to content

Commit

Permalink
Fix subtitles stream selection, change default config values (English…
Browse files Browse the repository at this point in the history
… first)
  • Loading branch information
Cuchulain committed Oct 11, 2023
1 parent f54ec96 commit 8f3fa87
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
10 changes: 5 additions & 5 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
DEFAULT_VALUES = {
'recoding': {
'preferred_languages': {
'audio': ['cze', 'slo'],
'subtitles': ['cze', 'slo'],
'audio': ['eng', 'cze', 'slo'],
'subtitles': ['eng', 'cze', 'slo'],
},
'codecs': {
'video': {
Expand All @@ -26,13 +26,13 @@
},
'dimensions': {
'max': {
'width': 1366,
'height': 768,
'width': 1920,
'height': 1080,
}
},
'quality': {
'video': {
'parameter': '-b:v 1200k', # or '-q:v 50' for example
'parameter': '-b:v 1200k', # or '-q:v 50' for example
}
},
},
Expand Down
15 changes: 8 additions & 7 deletions recode_video.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,12 +108,13 @@ def get_ffmpeg_parameters(file_path, params):

if subtitle_index is None:
for lang in list(params['preferred_languages']['subtitles']):
if lang in subtitles and lang not in forced_subtitles and lang not in audios:
subtitle_index = subtitles[lang]
subtitle_title = get_language_title(
lang,
metadata['streams'][subtitle_index]
)
if lang in subtitles and lang not in forced_subtitles:
if lang not in audios:
subtitle_index = subtitles[lang]
subtitle_title = get_language_title(
lang,
metadata['streams'][subtitle_index]
)
break

if audio_index is not None:
Expand Down Expand Up @@ -203,4 +204,4 @@ def get_command(command, file_path):

print("\nCall this command:\n{}\n".format(ffmpeg_command))

os.system(ffmpeg_command)
# os.system(ffmpeg_command)

0 comments on commit 8f3fa87

Please sign in to comment.