-
Notifications
You must be signed in to change notification settings - Fork 25
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MP4 Videos Unnecessarily Encoded During Trim #233
Comments
I don't know if there is a guarantee that the video is an mp4 so how about a fast check of the format and IF it is an mp4, add this Feel free to open a PR! |
@evamaxfield I was going to naively use the file extension, but it's a fair point that the ext might be lies! Using file ext + I'll submit a PR soon with the change. |
@whargrove once this build is done, wait ~5 minutes, then update your instance to use the new release: https://github.com/CouncilDataProject/cdp-backend/actions/runs/4916882908 |
Describe the Bug
In clip_and_reformat_video if the video is already mp4 ffmpeg will encode the output stream as mp4.
Expected Behavior
Use ffmpeg StreamCopy to avoid re-encoding an already mp4 encoded video.
Reproduction
Proof of concept with ffmpeg-python:
Existing implementation:
using
time python main.py
shows real ~3s. I didn't benchmark this so it's anecdotal. On my machine, the encode speed is ~20x (60 / 20 ~= 3).Use StreamCopy:
(Note the only difference is
codec='copy'
arg in output.)When using StreamCopy, the pipeline on my machine takes ~200ms.
Environment
Linux ld1 5.19.0-41-generic #42~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Apr 18 17:40:00 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
4.1.0.rc0
The text was updated successfully, but these errors were encountered: