AbCthings / vimeo-audio-video

Download segmented video from Vimeo
34 stars 18 forks source link

faster video and audio join #2

Open mwullink opened 4 years ago

mwullink commented 4 years ago

hi great tool, thx.

only dowsnside is that the joining of the audio and video files with ffmpeg takes too long and is very cpu heavy.

the easier and faster way is to use mkvmerge, with this it will only take a few secs to join the files.

install mkvmerge on mac with brew: https://formulae.brew.sh/cask/mkvtoolnix

print('Combining video and audio...') cmd = 'mkvmerge -o ' + output_file cmd += ' ' cmd += filenameAudio cmd += ' ' cmd += filenameVideo

tskir commented 4 years ago

Hi @mwullink! Originally this script did indeed use simple concatenation of segments (using ffmpeg -c:v copy -c:a aac, which I believe is equivalent to what mkvmerge is doing, and which also takes a couple of seconds). Unfortunately, what I discovered is that with this approach, about one out of every 5-10 downloaded videos becomes broken, especially if they are long ones. This probably has to do with how Vimeo splits files into chunks in the first place, maybe it does not always correctly handle key frames or some other features.

Because of this, the script was changed to always recode the input files. See https://github.com/AbCthings/vimeo-audio-video/pull/1/files.

Could you verify that with mkvmerge, downloading a few dozen long(ish) videos does not result in them being broken? By not broken I mean that if you start downloaded video playback and then skip almost to the very end, both video & audio should still play and be in sync