當我使用JavaCV庫(FFmpegFrameGrabber + FFmpegFrameRecorde)嘗試將dhav碼流轉為rtsp的時候,出現(xiàn)了以下報錯:文章來源:http://www.zghlxwxcb.cn/news/detail-602726.html
Error: [rtsp @ 0000002318df7c30] AAC with no global headers is currently not supported.
Exception in thread "pool-1-thread-2" java.lang.RuntimeException: org.bytedeco.javacv.FFmpegFrameRecorder$Exception: avformat_write_header error() error -1094995529: Could not write header to 'rtsp://127.0.0.1:8554/myapp/orange2' (For more details, make sure FFmpegLogCallback.set() has been called.)
at org.jfjy.jvc.GetBytes2PipedStreamAndPushRTMP$2.run(GetBytes2PipedStreamAndPushRTMP.java:116)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)
Caused by: org.bytedeco.javacv.FFmpegFrameRecorder$Exception: avformat_write_header error() error -1094995529: Could not write header to 'rtsp://127.0.0.1:8554/myapp/orange2' (For more details, make sure FFmpegLogCallback.set() has been called.)
at org.bytedeco.javacv.FFmpegFrameRecorder.startUnsafe(FFmpegFrameRecorder.java:969)
at org.bytedeco.javacv.FFmpegFrameRecorder.start(FFmpegFrameRecorder.java:437)
at org.bytedeco.javacv.FFmpegFrameRecorder.start(FFmpegFrameRecorder.java:432)
at org.jfjy.jvc.GetBytes2PipedStreamAndPushRTMP.grabAndPush(GetBytes2PipedStreamAndPushRTMP.java:215)
at org.jfjy.jvc.GetBytes2PipedStreamAndPushRTMP$2.run(GetBytes2PipedStreamAndPushRTMP.java:100)
... 3 more
意思就是缺少全局頭部信息的AAC編碼器不被支持,那么給它添加一些配置信息即可。文章來源地址http://www.zghlxwxcb.cn/news/detail-602726.html
//我在這個的基礎上
recorder.setAudioCodec(AV_CODEC_ID_AAC);
//添加了這行配置就好了
recorder.setAudioBitrate(grabber.getAudioBitrate());
到了這里,關于JavaCV error AAC with no global headers is currently not supported的文章就介紹完了。如果您還想了解更多內容,請在右上角搜索TOY模板網以前的文章或繼續(xù)瀏覽下面的相關文章,希望大家以后多多支持TOY模板網!