javacv
javacv copied to clipboard
video issue when generating mpeg-dash stream
iam trying to generating mpeg-dash stream using ffmpeg and javacv the issue with javacv its not spliting the video like the audio so it just generating one segment for the video contain all information and multiple segment for the audio like usual
see this image
for ffmpeg iam using (working fine)
ffmpeg -i input.mp4 -use_timeline 1 -use_template 1 -adaptation_sets "id=0,streams=v id=1,streams=a" -seg_duration 10 -f dash input.mpd
for javacv iam using (havving issue)
FFmpegFrameGrabber grabber = new FFmpegFrameGrabber("input.mp4");
grabber.start();
FFmpegFrameRecorder recorder = new FFmpegFrameRecorder("input.mpd", grabber.getImageWidth(), grabber.getImageHeight(), grabber.getAudioChannels());
recorder.setOption("use_timeline", "1");
recorder.setOption("use_template", "1");
recorder.setOption("adaptation_sets", "id=0,streams=v id=1,streams=a");
recorder.setOption("seg_duration", "10");
recorder.setFormat("dash");
recorder.start();
Frame frame;
while ((frame = grabber.grab()) != null) {
recorder.record(frame);
}
grabber.stop();
grabber.close();
recorder.flush();
recorder.close();
We can easily accomplish this with the ffmpeg program: http://bytedeco.org/javacpp-presets/ffmpeg/apidocs/org/bytedeco/ffmpeg/ffmpeg.html
@saudet thanks for you fast replay actually this code is part of streaming server to generate (hls,dash), i just build it to show the error that can not accept direct file , it only use FFmpegFrameGrabber with java InputStream
It doesn't sound like something that's currently supported, but contributions are welcome!
@saudet actually i don't have deep understand of the javacv but i can do if you highlighted some class that might contain the bug or the missing feature i can do