carykh / jumpcutter

Automatically edits vidx. Explanation here: https://www.youtube.com/watch?v=DQ8orIurGxw
MIT License
3.07k stars 544 forks source link

audio & video become out-of-sync #144

Open jpdeleon opened 4 years ago

jpdeleon commented 4 years ago

Hi,

It seems the audio and video get compressed in different rate somehow such that the end the final output, the video and audio became out-of-sync:

try for example , --url=https://www.youtube.com/watch?v=EYEHUOpwNvE

Lamaun commented 4 years ago

This project doesn't have an automatic frame rate detection (despite carykh claiming so in the video) Your input video had 24 fps, while jumpcutter guessed it was 30 fps. You could try a fork which automatically detects framerate. Otherwise just call jumpcutter like this:

python3 jumpcutter.py --url=https://www.youtube.com/watch?v=EYEHUOpwNvE --frame_rate 24

As the bells in your video are very loud and probably the only thing you want to hear, you also need quite an extreme value for the silent threshold. (The default value is 0.03 which means 3 % of the max audio amplitude) I would recommend something like --silent_threshold 0.4 for your video.

WaylonWalker commented 4 years ago

Thanks @Lamaun this fixed my issue as well.

mrbesen commented 4 years ago

i guess the problem lies in line: https://github.com/carykh/jumpcutter/blob/136df102fe9f94a83abf6825f798adf313ce4178/jumpcutter.py#L102 because he uses the static input.mp4 to read the parameters, i think this should be the variable INPUT_FILE or something else. Then the framerate detection may work.