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

trim video #117

Closed
djp0507 opened this issue Apr 7, 2015 · 7 comments
Closed

trim video #117

djp0507 opened this issue Apr 7, 2015 · 7 comments

Comments

@djp0507
Copy link

djp0507 commented Apr 7, 2015

I want to trim video in Android like “ffmpeg -ss 0:1:30 -t 0:0:20 -i input.mp4 -vcodec copy -acodec copy output.mp4 ”,but the ffmpeg.h does not exist .
what should i do? Thank you

@saudet saudet added the question label Apr 7, 2015
@saudet
Copy link
Member

saudet commented Apr 7, 2015

It's not exactly the same thing, but we can do something like this:

FrameGrabber grabber = new FFmpegFrameGrabber("input.avi");
grabber.start();
grabber.setTimestamp((1 * 60 + 30) * 1000000);

FrameRecorder recorder = new FFmpegFrameRecorder("output.mp4");
recorder.setFrameRate(grabber.getFrameRate());
recorder.setSampleRate(grabber.getSampleRate());
recorder.start();

Frame frame;
while ((frame = grabber.grab()) != null && recorder.getTimestamp() < 20 * 1000000) {
    recorder.record(frame);
}
recorder.stop();
grabber.stop();

@saudet saudet closed this as completed Apr 7, 2015
@pengliren
Copy link

-vcodec copy -acodec copy
no transcoding

@saudet
Copy link
Member

saudet commented Apr 8, 2015

@pengliren That's correct. But we could provide something like grabPacket() and recordPacket() methods to let user pass around packets without decoding them. Would you have some time to make the necessary modifications? Let me know, thanks!

@saudet saudet reopened this Apr 8, 2015
@pengliren
Copy link

@saudet ok, you provide grabPacket() and recordPacket() methods, I will try modifications.

@djp0507
Copy link
Author

djp0507 commented Apr 9, 2015

@saudet It can, but time is too long.

@saudet
Copy link
Member

saudet commented Apr 11, 2015

Marking as a duplicate of #93

@saudet
Copy link
Member

saudet commented Mar 24, 2019

FYI, if the ffmpeg program is sufficient, with commit bytedeco/javacpp-presets@13ffffd it now gets bundled and can be used easily from Java.

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

No branches or pull requests

3 participants