Javacv: record mjpeg stream

Created on 6 Nov 2019  Â·  4Comments  Â·  Source: bytedeco/javacv

Hello,I want to record mjpeg stream
I used the follow command and it work

ffmpeg -re -stream_loop -1 -r 1 -i 'http://@x.x.x.x/onvifsnap' -c:v libx264 -c:a aac -strict -2 -f hls -hls_time 3 -hls_list_size 10 -hls_wrap 0 output.m3u8

and I want to use javacv to implement the same function,

FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(input);
grabber.setOption("re"," ");
grabber.setOption("stream_loop","-1");
grabber.setOption("r","2");
grabber.setOption("c:v", "libx264");
grabber.setOption("c:a", "aac");

 FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(output + ".m3u8", 1280, 720, 1);
        recorder.setOption("r","2");
        recorder.setOption("c:v", "libx264");
        recorder.setOption("c:a", "aac");
        recorder.setOption("f", "hls");
        recorder.setOption("strict", "-2");
        recorder.setOption("hls_time", "3");
        recorder.setOption("hls_list_size", "10");
        recorder.setOption("hls_wrap", "0");

but it not work, Is there any configration wrong?

question

Most helpful comment

Hello Samuel
It works, Thanks a lot!!!

All 4 comments

If the ffmpeg program does what you need, we can use it as is from Java:
http://bytedeco.org/javacpp-presets/ffmpeg/apidocs/org/bytedeco/ffmpeg/ffmpeg.html
Does that answer your question?

I couldn't found the org.bytedeco.ffmpeg.ffmpeg.class, which dependency contains this class

Just use javacv-platform, that includes everything.

Hello Samuel
It works, Thanks a lot!!!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

SenudaJayalath picture SenudaJayalath  Â·  3Comments

myScoopAndroidCamera picture myScoopAndroidCamera  Â·  4Comments

chrisliu12345 picture chrisliu12345  Â·  4Comments

UpAndDownAgain picture UpAndDownAgain  Â·  3Comments

nghiepvth picture nghiepvth  Â·  3Comments