Reputation: 274
I wanted to trim video with ffmpeg worker mp4 but this going very slow during the process the video here is my command for this
["-y", "-i", "video.mp4", "-ss", "00:00", "-to", "00:07", "output.mp4"]
the video is trimming but with very slow and not working with mobile device showing memory allocation error. please help me for this
Upvotes: 1
Views: 2790
Reputation: 3613
You can place -ss
and -to
in front of -i
like below:
["-ss", "00:00:00", "-to", "00:00:07", "-i", "video.mp4", "output.mp4", "-y"]
It tells FFmpeg seek to the specified time before start decoding.
And by using -c copy
, FFmpeg will copies from the input to the output file without re-encoding streams.
Also, using trim filter may be helpful:
ffmpeg -i video.mp4 -vf "trim=start=0:end=7" -af "atrim=start=0:end=7" output.mp4 -y
Upvotes: 5