don't break on weird containers

This commit is contained in:
Ren Tatsumoto 2020-09-03 03:12:22 +03:00
parent 517d2d042f
commit 93fb741c5b

View file

@ -97,7 +97,7 @@ local function get_audio_track_number()
local track_selected = mp.get_property(string.format("track-list/%d/selected", i)) local track_selected = mp.get_property(string.format("track-list/%d/selected", i))
if track_type == "audio" and track_selected == "yes" then if track_type == "audio" and track_selected == "yes" then
audio_track_number = track_index - 1 audio_track_number = track_index
break break
end end
end end
@ -135,7 +135,7 @@ ffmpeg.create_videoclip = function(clip_filename, video_path, track_number)
'-to', tostring(menu.timings['end']), '-to', tostring(menu.timings['end']),
'-i', video_path, '-i', video_path,
'-map_metadata', '-1', '-map_metadata', '-1',
'-map', string.format("0:a:%d", track_number), '-map', string.format("0:%d", track_number),
'-map', '0:v:0', '-map', '0:v:0',
'-codec:a', 'libopus', '-codec:a', 'libopus',
'-codec:v', 'libx264', '-codec:v', 'libx264',
@ -160,7 +160,7 @@ ffmpeg.create_audioclip = function(clip_filename, video_path, track_number)
'-to', tostring(menu.timings['end']), '-to', tostring(menu.timings['end']),
'-i', video_path, '-i', video_path,
'-map_metadata', '-1', '-map_metadata', '-1',
'-map', string.format("0:a:%d", track_number), '-map', string.format("0:%d", track_number),
'-ac', '2', '-ac', '2',
'-codec:a', 'libopus', '-codec:a', 'libopus',
'-vbr', 'on', '-vbr', 'on',