bytedeco / javacv

Java interface to OpenCV, FFmpeg, and more
Other
7.6k stars 1.59k forks source link

grabber.start()出现问题 #2299

Open youzipipi opened 1 week ago

youzipipi commented 1 week ago

[rtsp @ 0x7fbbc024a480] Could not find codec parameters for stream 1 (Audio: none, 16000 Hz, mono): unknown codec Consider increasing the value for the 'analyzeduration' (10000) and 'probesize' (10000000) options Input #0, rtsp, from 'rtsp://admin:xxxx@192.168.17.xxx:554/Streaming/tracks/401?starttime=20241119t154020&endtime=20241119t154025z': Metadata: title : HIK Media Server V4.73.300 comment : HIK Media Server Session Description : standard Duration: -3767106:-29:-10.-32, start: 0.041000, bitrate: N/A Stream #0:0: Video: hevc (Main), yuvj420p(pc, bt709), 1920x1080, 24.92 tbr, 90k tbn Stream #0:1: Audio: none, 16000 Hz, mono org.bytedeco.javacv.FFmpegFrameGrabber$Exception: avcodec_find_decoder() error: Unsupported audio format or codec not found: 0. (For more details, make sure FFmpegLogCallback.set() has been called.)

saudet commented 1 week ago

What do you get if you call the ffprobe program on that URL?

youzipipi commented 6 days ago

如果您在该 URL 上调用 ffprobe 程序,您会得到什么?

I've gone through it again. The problem I encountered is that the audio encoding cannot be recognized. But strangely, I've already closed the audio channel:grabber.setAudioChannels(0);

The following is the output of ffprobe with some sensitive information replaced: [root@localhost order]# ffprobe rtsp://admin:xxx@192.xxx.xx:554/Streaming/tracks/401?starttime=20241119t154020&endtime=20241119t154025z [1] 1751742 [root@localhost order]# ffprobe version 5.1 Copyright (c) 2007-2022 the FFmpeg developers built with gcc 7.3.0 (GCC) configuration: --prefix=/usr/local/ffmpeg libavutil 57. 28.100 / 57. 28.100 libavcodec 59. 37.100 / 59. 37.100 libavformat 59. 27.100 / 59. 27.100 libavdevice 59. 7.100 / 59. 7.100 libavfilter 8. 44.100 / 8. 44.100 libswscale 6. 7.100 / 6. 7.100 libswresample 4. 7.100 / 4. 7.100 [rtsp @ 0x358fcc0] RTP: dropping old packet received too late Last message repeated 134 times [rtsp @ 0x358fcc0] Could not find codec parameters for stream 1 (Audio: none, 16000 Hz, mono): unknown codec Consider increasing the value for the 'analyzeduration' (0) and 'probesize' (5000000) options Input #0, rtsp, from 'rtsp://admin:xxx@192.168.xx.xx:554/Streaming/tracks/401?starttime=20241119t154020': Metadata: title : HIK Media Server V4.73.300 comment : HIK Media Server Session Description : standard Duration: -3767106:-29:-10.-32, start: 0.040000, bitrate: N/A Stream #0:0: Video: hevc (Main), yuvj420p(pc, bt709), 1920x1080, 24.92 tbr, 90k tbn Stream #0:1: Audio: none, 16000 Hz, mono Unsupported codec with id 0 for input stream 1

[1]+ 已完成 ffprobe rtsp://admin:xx@192.168.xx.xxx:554/Streaming/tracks/401?starttime=20241119t154020

The following is the output of the conversion in Java code: [rtsp @ 0x7f8fd4001340] Could not find codec parameters for stream 1 (Audio: none, 16000 Hz, mono): unknown codec Consider increasing the value for the 'analyzeduration' (200000) and 'probesize' (20000000) options Input #0, rtsp, from 'rtsp://admin:xxx@192.168.xx.xx:554/Streaming/tracks/401?starttime=20241119t154020&endtime=20241119t154025z': Metadata: title : HIK Media Server V4.73.300 comment : HIK Media Server Session Description : standard Duration: -3767106:-29:-10.-32, start: 0.041000, bitrate: N/A Stream #0:0: Video: hevc (Main), yuvj420p(pc, bt709), 1920x1080, 24.92 tbr, 90k tbn Stream #0:1: Audio: none, 16000 Hz, mono Output #0, flv, to 'rtmp://172.16.xx.xxx:1945/live/nud': Metadata: encoder : Lavf60.3.100 Stream #0:0: Video: hevc (Main) ([12][0][0][0] / 0x000C), yuvj420p(pc, bt709), 1920x1080, q=2-31, 24.92 fps, 1k tbn [flv @ 0x7f8fd47cee40] Timestamps are unset in a packet for stream 0. This is deprecated and will stop working in the future. Fix your code to set the timestamps properly

saudet commented 4 days ago

I see. I guess we should skip over streams that have no codecs. This should be fixed with commit 295e89f6ac86509b783b5c460a8a91496ca41c93. Please give it a try with the snapshots: http://bytedeco.org/builds/

youzipipi commented 2 days ago

295e89f.

Thank you. Currently, I have changed the encoding used for storage and it has been resolved normally I will try 295e89f again later