bilibili / ijkplayer

Android/iOS video player based on FFmpeg n3.4, with MediaCodec, VideoToolbox support.
GNU General Public License v2.0
32.54k stars 8.13k forks source link

我的rtsp在vlc中可以播放,但是在app端就播放不了 Failed to open file 'rtsp://IP:554/pag://IP:7302:摄像头编号:0:SUB:TCP?streamform=rtp' or configure filtergraph #5047

Open ushergo opened 4 years ago

ushergo commented 4 years ago

Failed to open file 'rtsp://IP:554/pag://IP:7302:摄像头编号:0:SUB:TCP?streamform=rtp' or configure filtergraph 我的rtsp在vlc中可以播放,但是在app端就播放不了,并且使用flv.js在客户端网页都可以播放的,就是在app端无法播放,请问这个问题怎么解决呢?(IP地址和编号我隐藏了的,防止泄密)

D/IJKMEDIA: rfps: 50.000000 0.000000 D/IJKMEDIA: Setting avg frame rate based on r frame rate W/IJKMEDIA: Could not find codec parameters for stream 0 (Video: hevc, 1 reference frame, none): unspecified size Consider increasing the value for the 'analyzeduration' and 'probesize' options W/IJKMEDIA: Could not find codec parameters for stream 1 (Audio: pcm_alaw, 8000 Hz, 1 channels, 64 kb/s): unspecified sample format Consider increasing the value for the 'analyzeduration' and 'probesize' options

I/IJKMEDIA: Stream #0:1 D/IJKMEDIA: , 0, 1/8000 I/IJKMEDIA: : Audio: pcm_alaw, 8000 Hz, 1 channels, 64 kb/s W/IJKMEDIA: No codec could be found with id 65543 W/IJKMEDIA: No codec could be found with id 174 A/IJKMEDIA: Failed to open file 'rtsp://IP:554/pag://IP:7302:摄像头编号:0:SUB:TCP?streamform=rtp' or configure filtergraph D/IJKMEDIA: FFP_MSG_ERROR: 0 I/IJKMEDIA: SDL_JNI_DetachThreadEnv: [9680] I/System.out: [CDS]close[35678] I/art: Thread[9,tid=9558,WaitingInMainSignalCatcherLoop,Thread=0xf4a0c400,peer=0x12c2c0a0,"Signal Catcher"]: reacting to signal 3 I/art: Wrote stack traces to '/data/anr/traces.txt' I/art: Thread[9,tid=9558,WaitingInMainSignalCatcherLoop,Thread=0xf4a0c400,peer=0x12c2c0a0,"Signal Catcher"]: reacting to signal 3 I/art: Wrote stack traces to '/data/anr/traces.txt' I/Choreographer: Skipped 84692 frames! The application may be doing too much work on its main thread. I/SurfaceView: updateWindow -- setFrame, this = net.cn_su.sharpeyes.police.media.SurfaceRenderView{26ef04ff V.E..... ........ 0,0-1371,1080} D/ListView: measureHeightOfChildren adapter = net.cn_su.sharpeyes.police.live.CameraAdapter@d08536f, startPosition = 0, endPosition = 5, maxHeight = 510, this = android.widget.ListView{4c8d29a VFED.VC. ......ID 0,0-516,510 #7f0d00c2 app:id/listView_camera} W/View: requestLayout() improperly called by android.support.v7.widget.AppCompatTextView{dee8db1 V.ED.... ......ID 75,7-474,68 #7f0d0145 app:id/textView_camera_name} during layout: running second layout pass W/View: requestLayout() improperly called by android.support.v7.widget.AppCompatTextView{25a47296 V.ED.... ......ID 75,83-474,132 #7f0d0096 app:id/textView_camera_address} during layout: running second layout pass I/SurfaceView: updateWindow -- OnPreDrawListener, mHaveFrame = true, this = net.cn_su.sharpeyes.police.media.SurfaceRenderView{26ef04ff V.E..... ........ 0,0-1371,1080} I/SurfaceView: updateWindow -- OnScrollChangedListener, this = android.view.SurfaceView$2@11c6dcba D/Surface: Surface::setBuffersDimensions(this=0xf49b1100,w=1080,h=1920) E/tv.danmaku.ijk.media.player.IjkMediaPlayer: Error (-10000,0) D/IjkVideoView: Error: -10000,0 D/video: onError D/FeatureProxyBase: FeatureProxyBase class constructor D/MultiWindow: MultiWindowProxy constructor. D/FeatureProxyBase: getService(), serviceName = multiwindow_service_v1 D/FeatureProxyBase: FeatureProxyBase class constructor D/MultiWindow: MultiWindowProxy constructor. D/FeatureProxyBase: getService(), serviceName = multiwindow_service_v1 D/STATUSBAR_DEBUG: vivo statusbar style D/PhoneWindow: isSystemApp attrs=WM.LayoutParams{(0,0)(wrapxwrap) gr=#11 ty=2 fl=#800000 surfaceInsets=Rect(0, 0 - 0, 0) needsMenuKey=2} D/STATUSBAR_DEBUG: IconColor=-2 StatusBarColor final set 0 D/ViewRootImpl: hardware acceleration is enabled, this = ViewRoot{683ae59 net.cn_su.sharpeyes.police/net.cnsu.sharpeyes.police.ui.live.LiveActivity,ident = 3} D/Dialog: show

ushergo commented 4 years ago

之前出现的是500错误,connection refused加了下面的参数就是上面的情况: ` ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec", 1);

ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "protocol_whitelist", "rtsp,rtmp,crypto,file,http,https,tcp,tls,udp"); `

ijkMediaPlayer 版本:

`//required, enough for most devices. compile 'tv.danmaku.ijk.media:ijkplayer-java:0.8.3' compile 'tv.danmaku.ijk.media:ijkplayer-armv7a:0.8.3'

// Other ABIs: optional
compile 'tv.danmaku.ijk.media:ijkplayer-armv5:0.8.3'
compile 'tv.danmaku.ijk.media:ijkplayer-arm64:0.8.3'
compile 'tv.danmaku.ijk.media:ijkplayer-x86:0.8.3'
compile 'tv.danmaku.ijk.media:ijkplayer-x86_64:0.8.3'

// ExoPlayer as IMediaPlayer: optional, experimental
compile 'tv.danmaku.ijk.media:ijkplayer-exo:0.8.3'

`

我的全部配置: ` IjkMediaPlayer ijkMediaPlayer = null; if (mUri != null) { ijkMediaPlayer = new IjkMediaPlayer(); ijkMediaPlayer.setOption(1, "analyzemaxduration", 100L); ijkMediaPlayer.setOption(1, "analyzeduration", 1L); // ijkMediaPlayer.setOption(1, "probesize", 10240L); ijkMediaPlayer.setOption(1, "probesize", 10240L); ijkMediaPlayer.setOption(1, "flush_packets", 1L); ijkMediaPlayer.setOption(4, "packet-buffering", 0L); ijkMediaPlayer.setOption(4, "framedrop", 1L);

                ijkMediaPlayer.native_setLogLevel(IjkMediaPlayer.IJK_LOG_DEBUG);

                if (mSettings.getUsingMediaCodec()) {
                    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec", 1);

// ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "avcodec", 1); if (mSettings.getUsingMediaCodecAutoRotate()) { ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec-auto-rotate", 1); } else { ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec-auto-rotate", 0); } if (mSettings.getMediaCodecHandleResolutionChange()) { ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec-handle-resolution-change", 1); } else { ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec-handle-resolution-change", 0); } } else { ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec", 0); }

                if (mSettings.getUsingOpenSLES()) {
                    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "opensles", 1);
                } else {
                    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "opensles", 0);
                }

                String pixelFormat = mSettings.getPixelFormat();
                if (TextUtils.isEmpty(pixelFormat)) {
                    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "overlay-format", IjkMediaPlayer.SDL_FCC_RV32);
                } else {
                    ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "overlay-format", pixelFormat);
                }
                ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "protocol_whitelist", "rtsp,rtmp,crypto,file,http,https,tcp,tls,udp");
                ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "framedrop", 1);
                ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "start-on-prepared", 0);
                ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "timeout", 90000);

                ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "http-detect-range-support", 0);
                ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "rtsp_transport", "tcp");

                ijkMediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_CODEC, "skip_loop_filter", 48);
            }
            mediaPlayer = ijkMediaPlayer;
        }

`

ushergo commented 4 years ago

我看了下这篇文章,说是要去掉 -c copy ,但是我也不知道怎么设置参数 https://ask.csdn.net/questions/666091 image