bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.49k stars 1.57k forks source link

Issue while starting HLS live Video Streaming on two cameras Simultaneously #1499

Open ajay-java opened 3 years ago

ajay-java commented 3 years ago

I'm trying to start video Streaming on two cameras Simultaneously but I'm facing below issue. org.bytedeco.javacv.FrameGrabber$Exception: avformat_open_input() error -1482175992: Could not open input "". (Has setFormat() been called?)

Sometimes streaming get's started on both the cameras and then Application getting stopped suddenly.

h264 (Constrained Baseline), yuv420p, 240x160, q=2-31, 800 kb/s, 24 fps, 90k tbn, 24 tbc [libx264 @ 0000022388bc5480] -qscale is ignored, -crf is recommended. [libx264 @ 0000022388bc5480] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 0000022388bc5480] profile High, level 1.2, 4:2:0, 8-bit [libx264 @ 0000022388bc5480] 264 - core 159 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=2 lookahead_threads=2 sliced_threads=1 slices=2 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc=crf mbtree=0 crf=49.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 [hls @ 0000022388f05080] Opening '/tmp/CCTV2/240p/CCTV2_2400.ts' for writing Output #0, hls, to '/tmp/CCTV2/240p/CCTV2_240.m3u8': Metadata: encoder : Lavf58.29.100 Stream #0:0: Video: h264 (Constrained Baseline), yuv420p, 240x160, q=2-31, 800 kb/s, 24 fps, 90k tbn, 24 tbc [libx264 @ 0000022388bbf940] -qscale is ignored, -crf is recommended. [libx264 @ 0000022388bbf940] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 0000022388bbf940] profile High, level 1.2, 4:2:0, 8-bit [libx264 @ 0000022388bbf940] 264 - core 159 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=2 lookahead_threads=2 sliced_threads=1 slices=2 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc=crf mbtree=0 crf=49.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 [hls @ 0000022388f06380] Opening '/tmp/CCTV1/240p/CCTV1_2400.ts' for writing Output #0, hls, to '/tmp/CCTV1/240p/CCTV1_240.m3u8': Metadata: encoder : Lavf58.29.100 Stream #0:0: Video: h264 (Constrained Baseline), yuv420p, 240x160, q=2-31, 800 kb/s, 24 fps, 90k tbn, 24 tbc [libx264 @ 0000022388bc0280] -qscale is ignored, -crf is recommended. [libx264 @ 0000022388bc0280] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 @ 0000022388bc0280] profile High, level 1.2, 4:2:0, 8-bit [libx264 @ 0000022388bc0280] 264 - core 159 - H.264/MPEG-4 AVC codec - Copyleft 2003-2019 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=2 lookahead_threads=2 sliced_threads=1 slices=2 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=0 weightp=2 keyint=250 keyint_min=24 scenecut=40 intra_refresh=0 rc=crf mbtree=0 crf=35.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00 [hls @ 0000022388f069c0] Opening '/tmp/CCTV1/360p/CCTV1_3600.ts' for writing Output #0, hls, to '/tmp/CCTV1/360p/CCTV1_360.m3u8': Metadata: encoder : Lavf58.29.100 Stream #0:0: Video: h264 (Constrained Baseline), yuv420p, 240x160, q=2-31, 800 kb/s, 24 fps, 90k tbn, 24 tbc [hls @ 0000022388f06380] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 3750 >= 3750 [hls @ 0000022388f06380] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 11250 >= 11250

Can anyone please help me in this??

I'm Using Java openJDK 11 version with spring boot 2.x version.

saudet commented 3 years ago

[hls @ 0000022388f06380] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 3750 >= 3750 [hls @ 0000022388f06380] Application provided invalid, non monotonically increasing dts to muxer in stream 0: 11250 >= 11250

You'll need to make sure this doesn't happen. That's caused by incorrect calls to setTimestamp().

saudet commented 3 years ago

You'll probably need to call it for each frame.

ajay-java commented 3 years ago

If I'm starting streaming on single camera in that case everything is working fine. Whenever I'm trying to start streaming on multiple camera then only I'm facing this issue