Use ffmpeg -i video.mp4 -i audio.mp4 -c:v copy -c:a aac -strict experimental output.mp4
to merge audio and video files.
ffmpeg: https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-essentials.zip
Script principle (Chinese): https://www.v2ex.com/t/856510
Github: https://github.com/dabaisuv/Tampermonkey-Script
Tips:
After the cache progress is loaded to 100 %, the video and audio file will be downloaded automatically ~
You can play video with 16x rate (document.querySelector('video').playbackRate = x
), or fast-forward video before cache progress, but please do not let the current progress bar exceeds the cache progress bar of the video bar. That will lead to the corresponding fragment of the video or audio lack of downloaded!
The script adds some variables on window:
Set in the console:
1.window.downloadAll
Set this value to 1 (window.downloadAll = 1) to download cached audio and video files (best to wait for the video to finish playing before setting it to avoid audio and video out of sync)
2.window.quickPlay
This value is the playback speed of the video in the page, the default is 1. You can set it up to 16 (window.quickPlay = x)
Replace window.quickPlay = x
with document.querySelector('video').playbackRate = x
3.window.autoDownload
Set window.autoDownload = 1 (defaul 1)
in the source file will automatically download the video after it finishes playing, and it will automatically play at 16x speed
QA
Why did the website only download one file at the end?
Please check whether the browser intercepts multiple files to download.
Which websites can be used?
On all websites that can legal use of this script.
Why are you a Chinese who wants to write this script in English?
English is a general language. Under the automatic translation of the webpage, it may be more suitable for places in different languages.
I want to download the cache files in advance, how do I do it?
Enter Window.downloadall = 1
in the console, but this method is invalid for the video in iframe, and the downloaded video will be blank, because the iFrame webpage is different from the environment where the console is located, and they have no shared variables. So it is best to let it download automatically.
What should I do if the downloaded audio does not play properly?
Just do it with Format Factory or Addobe Pr convert audio.mp4 to mp3 or aac(feedback from netizens). I personally recommend ffmpeg -i audio.mp4 -c:a aac output.mp4
to convert it and try it out.
How to input command. For example document.querySelector('video').playbackRate = x
或 window.downloadAll
? Click F12
on the keyboard to enter the developer interface, then find the console option, and then enter the command.
What should I do if the downloaded audio file does not play properly?
Just use format factory or ffmpeg to separate it into mp3 format, from netizens.
Feature
- Anti-hook detection.
- Support iframe video download.
- Video cache 100%automatic download ( which can be configured with
window.Autodownload = 0
at the source code to close it ).
- Use the console to enter
window.downloadAll = 1
to download the captured clips.
- Support almost all websites.
History:
2022.6.1: add some anti-hook detection.
Disclaimer: Please use scripts within the legal scope. Do not use it for any illegal use. The consequences have nothing to do with the author.