public void toRtmp(String out) throws IOException {
record = new FFmpegFrameRecorder(out, width, height);
record.setGopSize(2);
record.setFrameRate(grabber.getFrameRate());
record.setVideoBitrate(bitrate);
record.setPixelFormat(avutil.AV_PIX_FMT_YUV420P);
record.setVideoCodec(avcodec.AV_CODEC_ID_H264);
AVFormatContext fc = null;
if (out.contains("rtmp") || out.indexOf("flv") > 0) {
record.setFormat("flv");
//record.setFormat("hevc");
if(audiocodecid!=0){
record.setAudioCodecName("aac");
}
fc = grabber.getFormatContext();
}
record.start(fc);
}
I set recorder's VideoCodec to H264 but it doesn't work.
Could you tell me that javacv1.5.3 maybe change hevc to H264?
I see ffmpeg 4.2.2 can do it.
Sure, it works fine. Please try again with JavaCV 1.5.4-SNAPSHOT: http://bytedeco.org/builds/
Sure, it works fine. Please try again with JavaCV 1.5.4-SNAPSHOT: http://bytedeco.org/builds/
OK锛孖 try to use JavaCV 1.5.4,and my codes which I show is right?
Yeah, that looks alright...
Yeah, that _looks_ alright...
[rtsp @ 0000000000bfb400] Status 302: Redirecting to rtsp://172.20.105.67:9100/dss/monitor/param/cameraid=1000051%240%26substream=2?token=210&trackID=0
Input #0, rtsp, from 'rtsp://172.20.105.67:9090/dss/monitor/param?cameraid=1000051%240&substream=2':
Metadata:
title : RTSP Session/2.0
Duration: N/A, start: 0.040000, bitrate: N/A
Stream #0:0: Video: hevc (Main), yuvj420p(pc, bt470bg/bt470bg/bt709), 704x576, 25 fps, 25 tbr, 90k tbn, 90k tbc
[flv @ 000000002210f080] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
[flv @ 000000002210f080] Video codec hevc not compatible with flv
I used JavaCV 1.5.4-SNAPSHOT but it return this error.please tell me how can I change hevc to flv. I dont know how to fix it
[flv @ 000000002210f080] Video codec hevc not compatible with flv
It doesn't look like FFmpeg supports that with FLV. You'll probably need to use another format.
[flv @ 000000002210f080] Video codec hevc not compatible with flv
It doesn't look like FFmpeg supports that with FLV. You'll probably need to use another format.
but I used FFmpeg can do that : ffmpeg -rtsp_transport tcp -i "rtsp://172.20.105.67:9090/dss/monitor/param?cameraid=1000051%240&substream=1" -f flv rtmp://127.0.0.1:1935/live/mystream
it work fine.
if JavaCV is not supports,I have to find anohter way?
FLV works fine with h264, yes, so you can use that.
Most helpful comment
Yeah, that looks alright...