Open 964562398 opened 6 years ago
特别是IJKFFOptions 如何设置呢?
[options setPlayerOptionIntValue:30 forKey:@"max-fps"];
[options setPlayerOptionIntValue:30 forKey:@"r"];
//跳帧开关
[options setPlayerOptionIntValue:10 forKey:@"max_cached_duration"];
[options setPlayerOptionIntValue:1 forKey:@"infbuf"];
[options setPlayerOptionIntValue:10 forKey:@"probesize"];
[options setPlayerOptionIntValue:0 forKey:@"framedrop"];
[options setPlayerOptionIntValue:1 forKey:@"start-on-prepared"];
[options setPlayerOptionIntValue:0 forKey:@"http-detect-range-support"];
[options setPlayerOptionIntValue:48 forKey:@"skip_loop_filter"];
[options setPlayerOptionIntValue:0 forKey:@"packet-buffering"];
[options setPlayerOptionIntValue:2000000 forKey:@"analyzeduration"];
[options setPlayerOptionIntValue:25 forKey:@"min-frames"];
[options setPlayerOptionIntValue:1 forKey:@"start-on-prepared"];
[options setCodecOptionIntValue:8 forKey:@"skip_frame"];
[options setCodecOptionIntValue:100 forKey:@"analyzedmaxduration"];
[options setFormatOptionValue:@"nobuffer" forKey:@"fflags"];
[options setFormatOptionValue:@"1024" forKey:@"probsize"];
[options setFormatOptionValue:@"tcp" forKey:@"rtsp_transport"];
//自动转屏开关
[options setFormatOptionIntValue:0 forKey:@"auto_convert"];
//重连次数
[options setFormatOptionIntValue:1 forKey:@"reconnect"];
//开启硬解码
[options setFormatOptionIntValue:1 forKey:@"videotoolbox"];
[options setPlayerOptionIntValue:30 forKey:@"max-fps"];
这个是目前我拷贝其他人的
用其他的库链接是30fps但是ijk就是15fps
而且播放10多秒后就会卡死播放,不是卡死app
你说的问题有点玄学啊。一直用的这个播放器,貌似没出现你这些问题。试试我的 options = [IJKFFOptions optionsByDefault]; [IJKFFMoviePlayerController setLogReport:YES]; [IJKFFMoviePlayerController setLogLevel:k_IJK_LOG_DEBUG]; [options setPlayerOptionIntValue:30 forKey:@"max-fps"]; [options setPlayerOptionIntValue:1 forKey:@"framedrop"]; [options setPlayerOptionIntValue:0 forKey:@"start-on-prepared"]; [options setPlayerOptionIntValue:0 forKey:@"http-detect-range-support"]; [options setPlayerOptionIntValue:0 forKey:@"packet-buffering"]; [options setPlayerOptionIntValue:2000000 forKey:@"analyzeduration"]; [options setPlayerOptionIntValue:25 forKey:@"min-frames"]; [options setPlayerOptionIntValue:1 forKey:@"start-on-prepared"]; //解码参数,画面更清晰 [options setCodecOptionIntValue:IJK_AVDISCARD_DEFAULT forKey:@"skip_loop_filter"]; // [options setCodecOptionIntValue:IJK_AVDISCARD_DEFAULT forKey:@"skip_frame"]; [options setFormatOptionValue:@"tcp" forKey:@"rtsp_transport"]; [options setFormatOptionValue:@"nobuffer" forKey:@"fflags"]; // [options setFormatOptionValue:@"8192" forKey:@"probsize"]; [options setFormatOptionIntValue:8192 forKey:@"probesize"]; [options setFormatOptionIntValue:2 forKey:@"auto_convert"]; [options setFormatOptionIntValue:1 forKey:@"reconnect"];
[options setPlayerOptionIntValue:1 forKey:@"videotoolbox"];
//帧速率(fps) (可以改,确认非标准桢率会导致音画不同步,所以只能设定为15或者29.97)
[options setPlayerOptionIntValue:29.97 forKey:@"r"];
// -vol——设置音量大小,256为标准音量。(要设置成两倍音量时则输入512,依此类推
[options setPlayerOptionIntValue:512 forKey:@"vol"];
@feng55 我不太了解这个 我按照你的复制进去能达到秒开,但是fps最大就是15 而且几秒后画面就不动了。而且我连接的还是局域网,是连接一个摄像头,里面实现了rtsp协议。而且延时一样的严重
@feng55 这是日志 av_version_info: ff3.4--ijk0.8.7--20180103--001 ijk_version_info: ijkmp_set_inject_opaque(0x282f18520) ijkmp_set_inject_opaque()=void ijkmp_set_ijkio_inject_opaque(0x282f18520) ijkmp_set_ijkio_inject_opaque()=void 2018-09-26 10:13:38.807203+0800 IJKMediaDemo[10868:1830842] OK setup GL ijkmp_ios_set_view(glView=0x10432c9a0) ijkmp_ios_set_view(glView=0x10432c9a0)=void 2018-09-26 10:13:38.813495+0800 IJKMediaDemo[10868:1830842] invalidateRenderBuffer 2018-09-26 10:13:38.814213+0800 IJKMediaDemo[10868:1830960] IJKSDLGLView: setupDisplay not ready ijkmp_set_data_source(url="rtsp://192.168.100.1:7070/H264VideoSMS") ijkmp_set_data_source(url="rtsp://192.168.100.1:7070/H264VideoSMS")=0 ijkmp_prepare_async() [FFPlayer @ 0x105005600] remove 'timeout' option for rtmp. ===== versions ===== [FFPlayer @ 0x105005600] ijkplayer : [FFPlayer @ 0x105005600] FFmpeg : ff3.4--ijk0.8.7--20180103--001 [FFPlayer @ 0x105005600] libavutil : 55.78.100 [FFPlayer @ 0x105005600] libavcodec : 57.107.100 [FFPlayer @ 0x105005600] libavformat : 57.83.100 [FFPlayer @ 0x105005600] libswscale : 4.8.100 [FFPlayer @ 0x105005600] libswresample: 2.9.100 ===== options ===== [FFPlayer @ 0x105005600] player-opts : min-frames = 25 [FFPlayer @ 0x105005600] player-opts : overlay-format = fcc-_es2 [FFPlayer @ 0x105005600] player-opts : r = 29 [FFPlayer @ 0x105005600] player-opts : http-detect-range-support = 0 [FFPlayer @ 0x105005600] player-opts : videotoolbox = 1 [FFPlayer @ 0x105005600] player-opts : videotoolbox-max-frame-width = 960 [FFPlayer @ 0x105005600] player-opts : video-pictq-size = 3 [FFPlayer @ 0x105005600] player-opts : analyzeduration = 2000000 [FFPlayer @ 0x105005600] player-opts : max-fps = 30 [FFPlayer @ 0x105005600] player-opts : framedrop = 1 [FFPlayer @ 0x105005600] player-opts : packet-buffering = 0 [FFPlayer @ 0x105005600] player-opts : start-on-prepared = 1 [FFPlayer @ 0x105005600] format-opts : ijkapplication = 4365386176 [FFPlayer @ 0x105005600] format-opts : ijkiomanager = 4364320880 [FFPlayer @ 0x105005600] format-opts : fflags = nobuffer [FFPlayer @ 0x105005600] format-opts : rtsp_transport = tcp [FFPlayer @ 0x105005600] format-opts : probesize = 8192 [FFPlayer @ 0x105005600] format-opts : auto_convert = 2 [FFPlayer @ 0x105005600] format-opts : safe = 0 [FFPlayer @ 0x105005600] format-opts : user-agent = ijkplayer [FFPlayer @ 0x105005600] format-opts : reconnect = 1 [FFPlayer @ 0x105005600] codec-opts : skip_frame = 0 [FFPlayer @ 0x105005600] codec-opts : skip_loop_filter = 0
ijkmp_prepare_async()=0 [FFPlayer @ 0x105005600] remove 'timeout' option for rtmp. [tcp @ 0x104240670] No default whitelist set Hit DNS cache hostname = 192.168.100.1 2018-09-26 10:13:38.837804+0800 IJKMediaDemo[10868:1830842] invalidateRenderBuffer 2018-09-26 10:13:38.837973+0800 IJKMediaDemo[10868:1830960] IJKSDLGLView: setupDisplay not ready [rtsp @ 0x10485dc00] SDP: v=0
o=- 7832389 1 IN IP4 192.168.100.1
s=Session streamed by "OnDemandRTSPServer"
i=H264VideoSMS
t=0 0
a=tool:LIVE555 Streaming Media v2015.07.23
a=type:broadcast
a=control:*
a=range:npt=0-
a=x-qt-text-nam:Session streamed by "OnDemandRTSPServer"
a=x-qt-text-inf:H264VideoSMS
m=video 0 RTP/AVP 96
c=IN IP4 0.0.0.0
b=AS:35000
a=rtpmap:96 H264/90000
a=fmtp:96 packetization-mode=1;profile-level-id=4D001F;sprop-parameter-sets=Z00AH+VAKALYgA==,aO4xEg==
a=control:track1
Failed to parse interval end specification '' 2018-09-26 10:13:38.875629+0800 IJKMediaDemo[10868:1831786] [si_destination_compare] send failed: Invalid argument [rtsp @ 0x10485dc00] video codec set to: h264 [rtsp @ 0x10485dc00] RTP Packetization Mode: 1 [rtsp @ 0x10485dc00] RTP Profile IDC: 4d Profile IOP: 0 Level: 1f [rtsp @ 0x10485dc00] Extradata set to 0x2838b3c40 (size: 22) [rtsp @ 0x10485dc00] setting jitter buffer size to 0 [rtsp @ 0x10485dc00] hello state=0 Failed to parse interval end specification '' Option ijkapplication not found. [h264 @ 0x104820600] nal_unit_type: 7, nal_ref_idc: 3 [h264 @ 0x104820600] nal_unit_type: 8, nal_ref_idc: 3 [h264 @ 0x104820600] nal_unit_type: 7, nal_ref_idc: 3 [h264 @ 0x104820600] nal_unit_type: 8, nal_ref_idc: 3 2018-09-26 10:13:38.892636+0800 IJKMediaDemo[10868:1830842] FFP_MSG_OPEN_INPUT: [h264 @ 0x104820600] nal_unit_type: 7, nal_ref_idc: 3 [h264 @ 0x104820600] nal_unit_type: 8, nal_ref_idc: 3 [h264 @ 0x104820600] nal_unit_type: 1, nal_ref_idc: 2 [h264 @ 0x104820600] Reinit context to 1280x720, pix_fmt: yuv420p [h264 @ 0x104820600] Frame num gap 3 1 [rtsp @ 0x10485dc00] Probe buffer size limit of 8192 bytes reached [rtsp @ 0x10485dc00] Stream #0: not enough frames to estimate rate; consider increasing probesize [rtsp @ 0x10485dc00] decoding for stream 0 failed [FFPlayer @ 0x105005600] max_frame_duration: 10.000 Input #0, rtsp, from 'rtsp://192.168.100.1:7070/H264VideoSMS': Metadata: title : Session streamed by "OnDemandRTSPServer" comment : H264VideoSMS Duration: N/A, start: 0.000000, bitrate: N/A Stream #0:0, 1, 1/90000: Video: h264, 1 reference frame, yuv420p(progressive, left), 1280x720, 0/1, 90k tbr, 90k tbn, 180k tbc 2018-09-26 10:13:38.962430+0800 IJKMediaDemo[10868:1830842] FFP_MSG_FIND_STREAM_INFO: [h264 @ 0x104882a00] nal_unit_type: 7, nal_ref_idc: 3 [h264 @ 0x104882a00] nal_unit_type: 8, nal_ref_idc: 3 m_max_ref_frames 2 m_max_ref_frames 2 after scale width 960 height 540 [FFPlayer @ 0x105005600] fps: 90000.000000 (normal) 2018-09-26 10:13:38.987141+0800 IJKMediaDemo[10868:1830842] FFP_MSG_VIDEO_DECODER_OPEN: true flushed last keyframe pts 0 2018-09-26 10:13:38.987900+0800 IJKMediaDemo[10868:1830842] FFP_MSG_COMPONENT_OPEN: 2018-09-26 10:13:38.988354+0800 IJKMediaDemo[10868:1830842] FFP_MSG_VIDEO_SIZE_CHANGED: 1280, 720 2018-09-26 10:13:38.988734+0800 IJKMediaDemo[10868:1830842] FFP_MSG_SAR_CHANGED: 0, 1 ijkmp_get_msg: FFP_MSG_PREPARED 2018-09-26 10:13:38.988934+0800 IJKMediaDemo[10868:1830842] FFP_MSG_PREPARED: ijkmp_get_meta_l ijkmp_get_meta_l()=void ijkmp_set_playback_rate(1.000000) [FFPlayer @ 0x105005600] Playback rate: 1.000000 ijkmp_set_playback_rate()=void ijkmp_set_playback_volume(1.000000) ijkmp_set_playback_volume()=void 2018-09-26 10:13:38.989116+0800 IJKMediaDemo[10868:1830842] mediaIsPreparedToPlayDidChange 2018-09-26 10:13:38.989145+0800 IJKMediaDemo[10868:1830842] loadStateDidChange: IJKMPMovieLoadStatePlaythroughOK: 3 2018-09-26 10:13:38.989196+0800 IJKMediaDemo[10868:1830842] IJKMPMoviePlayBackStateDidChange 1: playing m_max_ref_frames 2 after scale width 960 height 540 decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr decode callback -12909 kVTVideoDecoderBadDataErr SDL_VoutVideoToolBox_CreateOverlay(w=960, h=540, fmt=_VTB, dp=0x283886440) Video: first frame decoded 2018-09-26 10:13:39.908397+0800 IJKMediaDemo[10868:1830842] FFP_MSG_VIDEO_SIZE_CHANGED: 960, 540 2018-09-26 10:13:39.908683+0800 IJKMediaDemo[10868:1830842] FFP_MSG_VIDEO_DECODED_START: [GLES2] Version = OpenGL ES 2.0 Metal - 58.3 [GLES2] Vendor = Apple Inc. [GLES2] Renderer = Apple A10 GPU [GLES2] Extensions = GL_OES_depth_texture GL_OES_depth_texture_cube_map GL_OES_depth24 GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_mapbuffer GL_OES_packed_depth_stencil GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_texture_float GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_vertex_array_object GL_EXT_blend_minmax GL_EXT_color_buffer_half_float GL_EXT_debug_label GL_EXT_debug_marker GL_EXT_discard_framebuffer GL_EXT_draw_instanced GL_EXT_instanced_arrays GL_EXT_map_buffer_range GL_EXT_occlusion_query_boolean GL_EXT_pvrtc_sRGB GL_EXT_read_format_bgra GL_EXT_separate_shader_objects GL_EXT_shader_framebuffer_fetch GL_EXT_shader_texture_lod GL_EXT_shadow_samplers GL_EXT_sRGB GL_EXT_texture_filter_anisotropic GL_EXT_texture_rg GL_EXT_texture_storage GL_APPLE_clip_distance GL_APPLE_color_buffer_packed_float GL_APPLE_copy_texture_levels GL_APPLE_framebuffer_multisample GL_APPLE_rgb_422 GL_APPLE_sync GL_APPLE_texture_format_BGRA8888 GL_APPLE_texture_max_level GL_APPLE_texture_packed_float GL_IMG_read_format GL_IMG_texture_compression_pvrtc create render yuv420sp_vtb use render yuv420sp_vtb 2018-09-26 10:13:39.928655+0800 IJKMediaDemo[10868:1831785] IJKSDLGLView: renderbufferStorage fromDrawable 2018-09-26 10:13:39.932178+0800 IJKMediaDemo[10868:1830842] FFP_MSG_VIDEO_SIZE_CHANGED: 960, 540 IJK_GLES2_Renderer_TexCoords_cropRight SDL_VoutVideoToolBox_CreateOverlay(w=960, h=540, fmt=_VTB, dp=0x283886440) 2018-09-26 10:13:39.941874+0800 IJKMediaDemo[10868:1830842] FFP_MSG_VIDEO_RENDERING_START: SDL_VoutVideoToolBox_CreateOverlay(w=960, h=540, fmt=_VTB, dp=0x283886440) 2018-09-26 10:13:39.958643+0800 IJKMediaDemo[10868:1830842] FFP_MSG_VIDEO_SIZE_CHANGED: 960, 540
你用什么播放器播是30帧的,理论上你推流多少帧,拉流就是多少帧。你可以把你的地址发给我试一下
@feng55 是局域网摄像头的地址,外网用不了,是别人写的库,网上找不到的,而且也看不到源码的,没有推流,拉流30帧,你有可以用来测试的rtsp流吗?我想看看是不是我编译库哪里少加了什么东西导致的,我用easyplay可以达到30帧,用大牛的可以达到20多,而且都不会有延迟
确实能秒开了~~~
请问要如何设置?