当前位置:网站首页>Inaccurate problem of flutter fijkplayer seekto
Inaccurate problem of flutter fijkplayer seekto
2022-07-26 08:27:00 【Peanut - Summer】
ijkplayer and ffplay In the open rtmp Streaming video , Most people will encounter 5~10 Second delay , stay ffplay When the play , If you add -fflags nobuffer It can shorten the playback rtmp Video delay in 1s Inside , And in the IjkMediaPlayer Add
mediaPlayer.setOption(1, "analyzemaxduration", 100L);
mediaPlayer.setOption(1, "probesize", 10240L);
mediaPlayer.setOption(1, "flush_packets", 1L);
mediaPlayer.setOption(4, "packet-buffering", 0L);
mediaPlayer.setOption(4, "framedrop", 1L);
1: Set whether to turn on tone change
mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,"soundtouch",isModifyTone?0:1);
2: Set whether to turn on loop filtering : 0 Turn on , High picture quality , High decoding overhead ,48 close , Poor picture quality , Low decoding overhead
mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_CODEC,"skip_loop_filter",isSkipLoopFilter?0:48L);
3: Set the maximum detection time before playing
mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT,"analyzemaxduration",100L);
4: Set the detection time before playing 1, Achieve the first screen second on effect
mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT,"analyzeduration",1);
5: Detection before playback Size, The default is 1M, A little smaller will make the picture faster
mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT,"probesize",1024*10);
6: Every time I deal with one packet Then refresh io Context
mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT,"flush_packets",1L);
7: Whether to turn on pre buffering , Generally, live broadcast projects will be opened , Achieve the effect of seconds on , However, it brings the experience of playing frame dropping and blocking
mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,"packet-buffering",isBufferCache?1:0);
8: Playback reconnection times
mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,"reconnect",5);
9: Maximum buffer size , Company kb
mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,"max-buffer-size",maxCacheSize);
10: Frame skipping , discharge CPU When processing is slow , Do frame skipping , Make sure the playback process , Picture and sound synchronization
mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,"framedrop",5);
11: Maximum fps
mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER,"max-fps",30);
12: Set the hard decoding method
jkPlayer Support hard decoding and soft decoding . The video angle will not be rotated during soft decoding. You need to pass it at this time onInfo Of what == IMediaPlayer.MEDIA_INFO_VIDEO_ROTATION_CHANGED To get the angle , Rotate the picture by yourself . Or turn on hard decoding , However, hard decoding is easy to cause black screen silence ( Hardware compatibility issues ), The following is the code related to setting hard decoding
mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec", 1);
mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec-auto-rotate", 1);
mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "mediacodec-handle-resolution-change", 1);
13.SeekTo Set optimization
Some videos are SeekTo When , Will jump back to the position before dragging , This is because of the key frame of the video , Popular is FFMPEG Are not compatible , Video compression is too strong ,seek Only key frames are supported , This occurs in the original video file i Fewer frames
mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "enable-accurate-seek", 1);
14. solve m3u8 File drag problem such as : One 3 How many hours of audio files , Start playing for a few seconds , Then drag to 2 About an hour or so , want loading 10 minute
mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "fflags", "fastseek");// Set up seekTo Can fast seek Go to the specified location and play
Important records , List of questions
1. After setting , High bit rate m3u8 Play Caton , The sound and picture are not synchronized , Or just pictures , No sound , Or the sound and picture are not synchronized
// Some videos are SeekTo When , Will jump back to the position before dragging , This is because of the key frame of the video , Popular is FFMPEG Are not compatible , Video compression is too strong ,seek Only key frames are supported , This occurs in the original video file i Fewer frames
mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "enable-accurate-seek", 1);
// Detection before playback Size, The default is 1M, A little smaller will make the picture faster
mediaPlayer.setOption(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "probesize", 1024 * 10);reference Android That's it
边栏推荐
猜你喜欢

Apple's tough new rule: third-party payment also requires a percentage, and developers lose a lot!

2022-7-6 personal qualifying 3 competition experience

Dev gridcontrol captures key events

The second lesson is the construction of development environment

2022-7-7 personal qualifying 4 competition experience

Dev gridcontrol 捕获按键事件

QT note 2

Nodejs2day (modularization of nodejs, NPM download package, module loading mechanism)

The most complete network: detailed explanation of six constraints of MySQL

宇宙第一 IDE 霸主,换人了。。。
随机推荐
2022 / 7 / 16 exam summary
The second lesson is the construction of development environment
A little awesome, 130000 a month+
Recurrence of strtus2 historical vulnerability
Common Oracle functions
Differences and connections of previewkeydown, Keydown, keypress and Keyup in C WinForm
Vscode utility shortcut
Burp suite Chapter 5 how to use burp target
Two ways to monitor the change of user points
2022-7-4 personal qualifying 1 competition experience
2022/7/9 exam summary
Awk operation
分享高压超低噪声LDO测试结果(High Voltage Ultra-low Noise LDO)
CV learning notes (optical flow)
Apple's tough new rule: third-party payment also requires a percentage, and developers lose a lot!
Use of room database in kotlin
Function default parameters, arrow functions, and remaining parameters in ES6 - explanation
2022 national vocational college skills competition "network security" competition question file upload penetration test answer flag
Burp suite Chapter 9 how to use burp repeater
ORACLE 官方文档