Javacv: org.bytedeco.javacv.FrameRecorder$Exception: avio_open2 error() error -5: Could not open 'null'

Created on 9 May 2020  ·  5Comments  ·  Source: bytedeco/javacv

Hi!
When streaming rtsp to rtmp I found this exception

org.bytedeco.javacv.FrameRecorder$Exception: avio_open2 error() error -5: Could not open 'null'
    at org.bytedeco.javacv.FFmpegFrameRecorder.startUnsafe(FFmpegFrameRecorder.java:859)
    at org.bytedeco.javacv.FFmpegFrameRecorder.start(FFmpegFrameRecorder.java:384)
    at org.bytedeco.javacv.FFmpegFrameRecorder.start(FFmpegFrameRecorder.java:379)
    at com.junction.util.CameraPush.to(CameraPush.java:190)

Here is the log, i removed some trival detail

[2020-05-09 16:56:10.094] [main] [INFO ] [com.junction.CameraServerApplication] : Starting CameraServerApplication on LAPTOP-ZT with PID 25244 (D:\git\prj\RTSPtoRTMP\target\classes started by zt in D:\git\prj\RTSPtoRTMP)
[2020-05-09 16:56:10.099] [main] [DEBUG] [com.junction.CameraServerApplication] : Running with Spring Boot v2.2.2.RELEASE, Spring v5.2.2.RELEASE
[2020-05-09 16:56:10.099] [main] [INFO ] [com.junction.CameraServerApplication] : No active profile set, falling back to default profiles: default
[2020-05-09 16:56:10.921] [main] [INFO ] [o.s.boot.web.embedded.tomcat.TomcatWebServer] : Tomcat initialized with port(s): 8082 (http)
[2020-05-09 16:56:10.930] [main] [INFO ] [org.apache.coyote.http11.Http11NioProtocol] : Initializing ProtocolHandler ["http-nio-8082"]
[2020-05-09 16:56:10.931] [main] [INFO ] [org.apache.catalina.core.StandardService] : Starting service [Tomcat]
[2020-05-09 16:56:10.931] [main] [INFO ] [org.apache.catalina.core.StandardEngine] : Starting Servlet engine: [Apache Tomcat/9.0.29]
[2020-05-09 16:56:11.047] [main] [INFO ] [o.a.c.c.C.[Tomcat].[localhost].[/camera]] : Initializing Spring embedded WebApplicationContext
[2020-05-09 16:56:11.048] [main] [INFO ] [org.springframework.web.context.ContextLoader] : Root WebApplicationContext: initialization completed in 896 ms
[2020-05-09 16:56:11.230] [main] [INFO ] [o.s.scheduling.concurrent.ThreadPoolTaskExecutor] : Initializing ExecutorService 'applicationTaskExecutor'
[2020-05-09 16:56:11.364] [main] [INFO ] [org.apache.coyote.http11.Http11NioProtocol] : Starting ProtocolHandler ["http-nio-8082"]
[2020-05-09 16:56:11.388] [main] [INFO ] [o.s.boot.web.embedded.tomcat.TomcatWebServer] : Tomcat started on port(s): 8082 (http) with context path '/camera'
[2020-05-09 16:56:11.391] [main] [INFO ] [com.junction.CameraServerApplication] : Started CameraServerApplication in 2.173 seconds (JVM running for 4.321)
[2020-05-09 16:56:11.395] [timeTimer] [INFO ] [com.junction.util.TimerUtil] : ******   执行定时任务       BEGIN   ******
[2020-05-09 16:56:11.395] [timeTimer] [INFO ] [com.junction.util.TimerUtil] : ******   执行定时任务       END     ******
[2020-05-09 16:56:30.417] [http-nio-8082-exec-1] [INFO ] [o.a.c.c.C.[Tomcat].[localhost].[/camera]] : Initializing Spring DispatcherServlet 'dispatcherServlet'
[2020-05-09 16:56:30.417] [http-nio-8082-exec-1] [INFO ] [org.springframework.web.servlet.DispatcherServlet] : Initializing Servlet 'dispatcherServlet'
[2020-05-09 16:56:30.422] [http-nio-8082-exec-1] [INFO ] [org.springframework.web.servlet.DispatcherServlet] : Completed initialization in 4 ms
[2020-05-09 16:56:30.460] [http-nio-8082-exec-1] [INFO ] [com.junction.controller.CameraController] : 打开:rtsp://admin:[email protected]:554/cam/playback?channel=3&subtype=0&starttime=2020_05_07_09_00_00&endtime=2020_05_07_11_00_00
[2020-05-09 16:56:31.000] [pool-1-thread-1] [DEBUG] [com.junction.util.CameraPush] : ******   TCPCheck    BEGIN   ******
[2020-05-09 16:56:31.004] [pool-1-thread-1] [DEBUG] [com.junction.util.CameraPush] : ******   TCPCheck    END     ******
[2020-05-09 16:56:31.004] [pool-1-thread-1] [DEBUG] [com.junction.util.CameraPush] : ******   grabber.start()    BEGIN   ******
Probing rtsp score:100 size:0

[tcp @ 000000002a3bc340] Original list of addresses:

[tcp @ 000000002a3bc340] Address 192.168.2.250 port 554

[tcp @ 000000002a3bc340] Interleaved list of addresses:

[tcp @ 000000002a3bc340] Address 192.168.2.250 port 554

[tcp @ 000000002a3bc340] Starting connection attempt to 192.168.2.250 port 554

[tcp @ 000000002a3bc340] Successfully connected to 192.168.2.250 port 554

[rtsp @ 000000002a3bb700] Sending:
OPTIONS rtsp://192.168.2.250:554/cam/playback?channel=3&subtype=0&starttime=2020_05_07_09_00_00&endtime=2020_05_07_11_00_00 RTSP/1.0
CSeq: 1
User-Agent: Lavf58.29.100

--

[rtsp @ 000000002a3bb700] ret=1 c=52 [R]




...........................



[rtsp @ 000000002a3bb700] line='WWW-Authenticate: Digest realm="Login to 3L07C9FPAMC7E3F", nonce="2c935dc40cd53c9c5f06e42942178fab"'

]

[rtsp @ 000000002a3bb700] ret=1 c=0a [
]

[rtsp @ 000000002a3bb700] line=''

[rtsp @ 000000002a3bb700] Sending:
OPTIONS rtsp://192.168.2.250:554/cam/playback?channel=3&subtype=0&starttime=2020_05_07_09_00_00&endtime=2020_05_07_11_00_00 RTSP/1.0
CSeq: 2
User-Agent: Lavf58.29.100
Authorization: Digest username="admin", realm="Login to 3L07C9FPAMC7E3F", nonce="2c935dc40cd53c9c5f06e42942178fab", uri="rtsp://192.168.2.250:554/cam/playback?channel=3&subtype=0&starttime=2020_05_07_09_00_00&endtime=2020_05_07_11_00_00", response="65b332b5279d30af1bb79d0818ffcc8e"

--

[rtsp @ 000000002a3bb700] ret=1 c=52 [R]

[rtsp @ 000000002a3bb700] ret=1 c=54 [T]

[rtsp @ 000000002a3bb700] ret=1 c=53 [S]

[rtsp @ 000000002a3bb700] ret=1 c=50 [P]

[rtsp @ 000000002a3bb700] ret=1 c=2f [/]

........... 

[rtsp @ 000000002a3bb700] id=0 len=1452

[h264 @ 000000002a42a400] unknown SEI type 229

[h264 @ 000000002a42a400] unknown SEI type 128

[h264 @ 000000002a42a400] nal_unit_type: 7(SPS), nal_ref_idc: 3

[h264 @ 000000002a42a400] nal_unit_type: 8(PPS), nal_ref_idc: 3

[h264 @ 000000002a42a400] nal_unit_type: 6(SEI), nal_ref_idc: 0

[h264 @ 000000002a42a400] nal_unit_type: 5(IDR), nal_ref_idc: 3

[h264 @ 000000002a42a400] unknown SEI type 229

[h264 @ 000000002a42a400] Format yuvj420p chosen by get_format().

[h264 @ 000000002a42a400] Reinit context to 1920x1088, pix_fmt: yuvj420p

[rtsp @ 000000002a3bb700] Probe buffer size limit of 5120 bytes reached

Warning: [rtsp @ 000000002a3bb700] Stream #0: not enough frames to estimate rate; consider increasing probesize

[rtsp @ 000000002a3bb700] decoding for stream 0 failed

[rtsp @ 000000002a3bb700] stream 0: start_time: 0.000 duration: 7200.000

[rtsp @ 000000002a3bb700] format: start_time: 0.000 duration: 7200.000 bitrate=0 kb/s

Input #0, rtsp, from 'rtsp://admin:[email protected]:554/cam/playback?channel=3&subtype=0&starttime=2020_05_07_09_00_00&endtime=2020_05_07_11_00_00':

  Metadata:

    title           : 
Media Server


  Duration: 
02:00:00.00
, start: 
0.000000
, bitrate: 
N/A


    Stream #0:0
, 1, 1/90000
: Video: h264 (High), 1 reference frame, yuvj420p(pc, bt709, progressive, left), 1920x1080 (1920x1088), 0/1
, 
90k tbr, 
90k tbn, 
180k tbc


detected 12 logical cores

[h264 @ 000000002e000200] nal_unit_type: 7(SPS), nal_ref_idc: 3

[h264 @ 000000002e000200] nal_unit_type: 8(PPS), nal_ref_idc: 3

[2020-05-09 16:56:31.636] [pool-1-thread-1] [DEBUG] [com.junction.util.CameraPush] : ******   grabber.start()    END     ******
[rtmp @ 000000002dffe3c0] No default whitelist set

[tcp @ 000000002dffe900] No default whitelist set

[tcp @ 000000002dffe900] Original list of addresses:

[tcp @ 000000002dffe900] Address 127.0.0.1 port 1935

[tcp @ 000000002dffe900] Interleaved list of addresses:

[tcp @ 000000002dffe900] Address 127.0.0.1 port 1935

[tcp @ 000000002dffe900] Starting connection attempt to 127.0.0.1 port 1935

[tcp @ 000000002dffe900] Successfully connected to 127.0.0.1 port 1935

[rtmp @ 000000002dffe3c0] Handshaking...

[rtmp @ 000000002dffe3c0] Type answer 3

[rtmp @ 000000002dffe3c0] Server version 13.14.10.13

[rtmp @ 000000002dffe3c0] Proto = rtmp, path = /history/767b921e-41ee-4677-9fd9-e24f57e898c0, app = history, fname = 767b921e-41ee-4677-9fd9-e24f57e898c0

[2020-05-09 16:56:31.750] [pool-1-thread-1] [ERROR] [com.junction.util.CameraPush] : rtsp://admin:[email protected]:554/cam/playback?channel=3&subtype=0&starttime=2020_05_07_09_00_00&endtime=2020_05_07_11_00_00  push error!
[2020-05-09 16:56:31.752] [pool-1-thread-1] [ERROR] [com.junction.util.CameraPush] : ffmpeg错误信息:
org.bytedeco.javacv.FrameRecorder$Exception: avio_open2 error() error -5: Could not open 'null'
    at org.bytedeco.javacv.FFmpegFrameRecorder.startUnsafe(FFmpegFrameRecorder.java:859)
    at org.bytedeco.javacv.FFmpegFrameRecorder.start(FFmpegFrameRecorder.java:384)
    at org.bytedeco.javacv.FFmpegFrameRecorder.start(FFmpegFrameRecorder.java:379)
    at com.junction.util.CameraPush.to(CameraPush.java:190)
    at com.junction.thread.CameraThread$MyRunnable.run(CameraThread.java:57)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
    at java.lang.Thread.run(Thread.java:748)
[rtsp @ 000000002a3bb700] Sending:
TEARDOWN rtsp://192.168.2.250:554/cam/playback?channel=3&subtype=0&starttime=2020_05_07_09_00_00&endtime=2020_05_07_11_00_00/ RTSP/1.0
CSeq: 6
User-Agent: Lavf58.29.100
Session: 283562908602
Authorization: Digest username="admin", realm="Login to 3L07C9FPAMC7E3F", nonce="2c935dc40cd53c9c5f06e42942178fab", uri="rtsp://192.168.2.250:554/cam/playback?channel=3&subtype=0&starttime=2020_05_07_09_00_00&endtime=2020_05_07_11_00_00/", response="2966eb4e83925395dcaf6fc720777bd6"

--

[2020-05-09 16:56:31.756] [pool-1-thread-1] [ERROR] [com.junction.thread.CameraThread] : currentTask: rtsp://admin:[email protected]:554/cam/playback?channel=3&subtype=0&starttime=2020_05_07_09_00_00&endtime=2020_05_07_11_00_00 stopped...

and here is the code I use

https://github.com/banmajio/RTSPtoRTMP/blob/master/src/main/java/com/junction/util/CameraPush.java

Thank you!

question

Most helpful comment

但是nginx-rtmp服务器可以正常工作
[tcp @ 000000002dffe900]成功连接到127.0.0.1端口1935

Isn't this my project?haha!

All 5 comments

Errno 5 in "Input/output error", so this just looks like a problem with your network connection...

but the nginx-rtmp server is working ok
[tcp @ 000000002dffe900] Successfully connected to 127.0.0.1 port 1935

但是nginx-rtmp服务器可以正常工作
[tcp @ 000000002dffe900]成功连接到127.0.0.1端口1935

Isn't this my project?haha!

Finnally ,I found i forgot to config application path of '/history' in nginx.conf,Thank you!

Could you please tell me how you configured nginx.conf?

Was this page helpful?
0 / 5 - 0 ratings