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

Support AVPacket to efficiently segment, trim, encode with hardware, stream multiple times, etc #93

Closed
dheerajbhaskar opened this issue Feb 17, 2015 · 6 comments

Comments

@dheerajbhaskar
Copy link

I'm referring to the -segment_time in the command below

ffmpeg -i fff.avi -acodec copy -f segment -segment_time 10 -vcodec copy -reset_timestamps 1 -map 0 -an fff%d.avi

Above code grabbed from http://unix.stackexchange.com/questions/148602/ffmpeg-split-video-multiple-parts

I'm also aware of this feature being requested earlier https://groups.google.com/forum/#!topic/javacv/4wO6gODaq4w

@saudet
Copy link
Member

saudet commented Feb 28, 2015

It's possible to do it manually by grabbing the frames and recording only the ones we're interested in. But, to be more efficient, we would need to provide a way to bypass the decoding and encoding process, and pass the packets directly:
https://code.google.com/p/javacv/issues/detail?id=456
Is this a project you would like to work on?

@saudet saudet mentioned this issue Apr 11, 2015
@saudet saudet changed the title Is segmenting support of ffmpeg accessible through javacv? Support AVPacket to efficiently segment, trim, encode with hardware, stream multiple times, etc Nov 3, 2015
@alicanalbayrak
Copy link
Contributor

Hi samuel,
I tried to bypass decode and encode process, and it seems works so far. (Only records video packets for now)

Remuxer.java

@saudet
Copy link
Member

saudet commented Mar 24, 2016

@alicanalbayrak Cool! Could you include the necessary logic in FFmpegFrameGrabber and FFmpegFrameRecorder? I'm thinking we could provide additional grabPacket() and recordPacket() methods for that.

@alicanalbayrak
Copy link
Contributor

Sure, I'll work on that. I'm planning to send you pull request in a few days.
.

saudet added a commit that referenced this issue Apr 16, 2016
 * Support `AVPacket` in `FFmpegFrameGrabber` and `FFmpegFrameRecorder` to copy without re-encoding (issue #93)
@saudet
Copy link
Member

saudet commented May 19, 2016

The implementation from @alicanalbayrak is part of the just released version 1.2! Thanks for the contribution :)

@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