use -ss and -to "properly"
this way just seeks to the bit you need and _then_ extracts it, instead of decoding everything and chucking away the bits we didn't ask for. massive performance increase, should've rtfm'd earlier
This commit is contained in:
parent
472fc5337d
commit
37de70000e
|
@ -60,10 +60,10 @@ end
|
|||
|
||||
function extract_audio(in_path, start_time, end_time, out_path, name, extension, copy)
|
||||
if copy == true then
|
||||
os.execute('ffmpeg -i "'..in_path..'" -codec copy -vn -ss '..start_time..'ms -to '..end_time..'ms "'..out_path..name..'.'..extension..'" -y')
|
||||
os.execute('ffmpeg -ss '..start_time..'ms -to '..end_time..'ms -i "'..in_path..'" -codec copy -vn "'..out_path..name..'.'..extension..'" -y')
|
||||
-- takes the video as input, copies the streams, but doesn't include video. sets it to start at the start of the selection, and end at the end of it. outputs to our chosen out path with our chosen name and extension. overwrites anything with the same name.
|
||||
elseif copy == false then
|
||||
os.execute('ffmpeg -i "'..in_path..'" -vn -ss '..start_time..'ms -to '..end_time..'ms "'..out_path..name..'.'..extension..'" -y')
|
||||
os.execute('ffmpeg -ss '..start_time..'ms -to '..end_time..'ms -i "'..in_path..'" -vn "'..out_path..name..'.'..extension..'" -y')
|
||||
-- same as above, but doesn't copy the stream (transcodes to flac)
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue