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

why FFmpegFrameRecorder.record() No data was retrieved? #2182

Open
songbiaoself opened this issue Feb 1, 2024 · 0 comments
Open

why FFmpegFrameRecorder.record() No data was retrieved? #2182

songbiaoself opened this issue Feb 1, 2024 · 0 comments

Comments

@songbiaoself
Copy link

javacv version is 1.5.9

private ByteArrayOutputStream stream;

...
FFmpegFrameRecorder recorder = new FFmpegFrameRecorder(stream, grabber.getImageWidth(), grabber.getImageHeight(),grabber.getAudioChannels());
recorder.setVideoCodec(avcodec.AV_CODEC_ID_H264);
recorder.setPixelFormat(avutil.AV_PIX_FMT_YUV420P);
recorder.setAudioCodec(avcodec.AV_CODEC_ID_AAC);
// ... Omit other parameters
recorder.record(frame);
log.info("byte size:{}", stream.size());
...

When my RTSP stream exists in audio, the total interval between my first frame data and the second frame is about 10 seconds (the subsequent frame interval is normal), and the data of the second frame is larger than other frames, which causes my front end to not work properly. Play. Frame spacing is normal when audio is not present.

2024-02-01 16:14:00.112INF012740---[1706775240085]byte size:401
2024-02-01 16:14:00.139INF012740---[1706775240085]byte size:0
2024-02-01 16:14:00.149INF012740---[1706775240085]byte size:0
2024-02-01 16:14:00.159INF012740---[1706775240085]byte size:0
...
2024-02-01 16:14:09.854INF012740---[1706775240085]byte size:321000
2024-02-01 16:14:09.889INF012740---[1706775240085]byte size:542

The front -end Chrome browser's WebSocket message data interface
image

This is the media information of the rtsp video stream seen on the VLC software
image

Hope a solution can be given!

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

2 participants