Skip to content
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

Sync with ffmpeg #1554

Open
gstrat88 opened this issue Jan 8, 2025 · 2 comments
Open

Sync with ffmpeg #1554

gstrat88 opened this issue Jan 8, 2025 · 2 comments

Comments

@gstrat88
Copy link

gstrat88 commented Jan 8, 2025

If I try to cut from ffmpeg using time input from the playback,
e.g bring me the 10second to 25second part of the video
ffmpeg -ss 10 -i test.mp4 -t 15 -c copy out.mp4
there are sometimes small time differences, which is propably normal!
Do you know if its possible to emulate the timings of ffmpeg to that of the module?

Thanks a lot!

@erankor
Copy link
Contributor

erankor commented Feb 8, 2025

Hi, sorry for the delay, the differences you are seeing may be because ffmpeg uses the "presentation time" (PTS), while this module uses the "decoding time" (DTS). You can check the DTS/PTS values of the frames using ffprobe, e.g. ffprobe -i test.mp4 -show_frames, and see if that explains the differences you are seeing.
Either way, the clipping feature of this module can only start a clip from a keyframe, while ffmpeg can also re-encode the video, and start a clip from any frame (that is not the case in the sample command you pasted, which uses codec copy, but in general...)

@gstrat88
Copy link
Author

gstrat88 commented Feb 8, 2025

Many thanks for the answer! No problem for the delay it was a busy month for me too.
It should have crossed my mind by looking the code that this sould be the issue, as I am aware of the pts/dts thing.

ffmpeg -i test.mp4 -c:v libx264 -filter:v "trim=start_pts=1584001492967:end_pts=1584001514967000" out.mp4
This would be a nice solution (if it accepts dts of cource) for my problem, but the filter means re-encoding :(
If I dont find another solution, do you happen to know any alternatives to ffmpeg that use dts? (difficult I know)
If I dont find another solution, I will try to make the modification in the module's source code for the thumb part.
If you believe that this won't work for any reason it would be nice to know!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants