rockcarry / fanplayer Goto Github PK
View Code? Open in Web Editor NEWA portable video player based on ffmpeg for windows and android platform.
License: GNU Lesser General Public License v3.0
A portable video player based on ffmpeg for windows and android platform.
License: GNU Lesser General Public License v3.0
Hi rockcarry,
Happy New Year! and I hope everything will come out all right for New year - 2019!
I am appreciate your project fanplayer for windows, but it's not work for android.
Could you pls explain me is it working on android?
Because, I build everything correct step by step according to your guide and it's build successfully to make apk.
But apk is crash when It run on simulator or android device.
I am so urgent with this problem.
So, I kindly ask you about problems for android version.
I hope to get good response with you.
Thanks
Android player:
low-latency mode causes audio to sound "choppy";
when disabling low-latency mode, there is a little sync issue between audio and video - audio sounds about 50-100 ms later.
Does the android player support SMB protocol?
Error at the time of building ./build_ffmpeg_for_android.sh
/toolchains/arm-linux-androideabi-4.9/prebuilt/windows/bin/arm-linux-androideabi-gcc is unable to create an executable file.
C compiler test failed.
NDK 16.1.447
安卓下,播放rtsp流,网络不好时候,中间自动重连三四次后,闪退
sysclock= c->cmnvars->start_pts + (tickcur - c->cmnvars->start_tick) * c->speed / 100;
scdiff = (int)(sysclock - c->cmnvars->vpts - c->tickavdiff);
avdiff = (int)(c->cmnvars->apts - c->cmnvars->vpts - c->tickavdiff);
avdiff = c->cmnvars->apts <= 0 ? scdiff : avdiff;
这里虽然有处理根据系统时间来判断,但是播放出来的效果是快进的。
用任务管理器查看,发现没用退出
ffmpeg/ffplay 当前版本是支持的,不知您这里的ffmpeg 版本是否支持
为了能够让播放器实现硬解,重新编译了ffmpeg(加入了编译选项:--enable-hwaccel=h264_mediacodec),decoder = avcodec_find_decoder_by_name("h264_mediacodec");这一句后,获取的decoder 不为空,但是执行到avcodec_open2(player->vcodec_context, decoder, NULL),返回值小于0,执行失败,用av_strerror函数输出错误:Generic error in an external library。运行环境:华为鸿蒙OS平板。
wifi环境中测试。
服务端为livedesk,对比测试,发现最新版本的音频有卡顿现象。
Will recording (mp4, on Android) be an issue for an upcoming release?
The performance of your player is great! (y)
Thanks for the Library ...!!!!!
int player_snapshot(void *hplayer, char *file, int w, int h, int waitt) ,int player_record(void *hplayer, char *file)
written code in ffplayer_jni.cpp
static void JNICALL nativeSnapshot(JNIEnv env, jobject obj, jlong hplayer)
{
__android_log_print(ANDROID_LOG_ERROR, "player_jni", "ERROR0: EnterNativeSnapshot\n");
DO_USE_VAR(env);
DO_USE_VAR(obj);
char filenamedata = (char*) "Demo";
player_snapshot((void*)hplayer,filenamedata,1440 ,2960 ,0);
__android_log_print(ANDROID_LOG_ERROR, "player_jni", "ERROR0: ExitNativeSnapshot\n");
}
static void JNICALL nativeRecord(JNIEnv env, jobject obj, jlong hplayer)
{
__android_log_print(ANDROID_LOG_ERROR, "player_jni", "ERROR0: EnterNativeRecord\n");
DO_USE_VAR(env);
DO_USE_VAR(obj);
char filenamedata = (char*) "Demo";
player_record((void*)hplayer,filenamedata);
__android_log_print(ANDROID_LOG_ERROR, "player_jni", "ERROR0: ExitNativeRecord\n");
}
There is no crash observed , but unable to find the snapshot image and record video locally ..Not sure whether file has been created or not ..?
Please let me know the file path about local storage ....After calling those methods which location files will be store ?
Tested with Android player apk code - Android App as test environment ... . so file has been updated as per new function calls...
@rockcarry Please do the needful to fix this issues ,Thanks for the Library ...!!!!!
/player-android/jni/_install/lib/libavformat.a: error adding symbols: File in wrong format
I play a local mp4 video. it only works on CPU,but not GPU.
I want to use GPU to play.
您好,此工程的ffmpeg版本是多少,目前的ffmpeg 都不支持flv封装H265,我已经写好兼容。但是对于播放不是很清楚,想在你的工程中修改,但是通过替换ffmpeg 库的形式,ffplay找不到想要的方法。所以想知道你的ffmpeg的方法,或者能否进一步沟通
void player_getparam(void *hplayer, int id, void *param);
这个函数可以获取吗?
比如编码类型H265,H264,帧率等信息?
Hi author, thanks for your share.
I try build funplayer on VS2017 and play video file,
but got error message on PlayerForm_Load
-> player_open
.
System.BadImageFormatException: 'An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)'
I do configure to build funplayer project follow by your instruction.
Add #define _TIMESPEC_DEFINED
Set No (/SAFESEH:NO)
csharpplayer project is only need one dll dependency right?
Thank you in advance
摄像头是海康的,视频编码是H264. 地址rtsp://admin:[email protected]:554/h264/ch1/main/av_stream
播放低清的没发现底部有黑色条。
用其他软件录制好1080P视频流成MP4,再用fanplayer打开就正常。
黑条具体表现为19201080的视频长宽比改变成1920900,相当于视频被压扁了一点点,下面有个1920*180的黑色条状。
900是大概数字,具体不知道是多少。这个评论没法发图片给你看。
snapshot.c里面的代码
// scale picture
sws_ctx = sws_getContext(video->width, video->height, video->format,
picture.width, picture.height, swsofmt, SWS_FAST_BILINEAR, NULL, NULL, NULL);
if (!sws_ctx) {
av_log(NULL, AV_LOG_ERROR, "could not initialize the conversion context jpg\n");
goto done;
}
sws_ctx的值为空,video->format的值是61即 AV_PIX_FMT_DXVA2_VLD
感觉硬解的时候AVFrame *video,video->data也是空,如何保存图片?
Hello,
first of all thank you for this awesome project. I tested the demo android application and I'm suprised with the excellent performance of the player.
Now I'm trying to build the ffmpeg library for the android application. My environment is an Ubuntu 20.04.3 (kernel: 5.11.0-37-generic)
. The build process results to the following error:
./fanplayer/player-android/jni/soundtouch/source/Android-lib/jni/soundtouch-lib.cpp:39:24: fatal error: soundtouch.h: No such file or directory
#include "soundtouch.h"
I have followed the steps from the readme (https://github.com/rockcarry/fanplayer/wiki/build-ffmpeg-for-android):
git clone https://github.com/rockcarry/fanplayer.git
cd player-android/jni
export ANDROID_NDK_HOME=/Downloads/android-ndk-r13b/
./build_fanplayer_jni.sh
no NDK arm-linux-androideabi-gcc on $PATH at (eval 10) line 124.
build_fanplayer_jni.sh
script from export PATH=$PATH:$ANDROID_NDK_HOME/toolchains/$TOOLCHAIN_PATH/prebuilt/windows-x86_64/bin
to export PATH=$PATH:$ANDROID_NDK_HOME/toolchains/$TOOLCHAIN_PATH/prebuilt/linux-x86_64/bin
./fanplayer/player-android/jni/soundtouch/source/Android-lib/jni/soundtouch-lib.cpp:39:24: fatal error: soundtouch.h: No such file or directory'
I have looked in the directory ./fanplayer/player-android/jni/soundtouch/source/Android-lib/jni
. There is no file named soundtouch.h
.
Do I missing something?
Best Regards,
DaAlx
Does it support a preview of audio or video? like ffplay does?
before saving it I want to check audio or video.
testplayer双击开只能打开本地视频,没有输
命令行传参数:
"
播放 rtmp 流媒体
testplayer rtmp://localhost:1983/live/test
"
这一步怎么搞
代码如下:
String url = "rtsp:\192.168.5.11\live"
public void startPlay()
{
if(null != mPlayer)
{
mPlayer.pause();
mPlayer.close();
}
mPlayer = new MediaPlayer(url, mHandler, initParam);
mPlayer.play();
}
调用上面函数,多次调用就会大概率闪退。有办法解决么?
大佬,请问下,linux平台需要自己移植哪几部分
正如标题所说的,fanplayer
支持网络视频实时播放吗?
例如,有一个网络MP4文件https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4
,能否使用
fanplayer
直接播放,而不需要先下载这个mp4文件?
Dear Sir
Google deploy Jetpack Compose
and then JetBrains modify Compose --> Compose for desktop
JetBrains use Kotlin Multiplatform -->mix to Compose Multiplatform https://github.com/JetBrains/compose-jb
but now lost VideoPlayer !!
https://github.com/JetBrains/compose-jb/tree/master/components/VideoPlayer <---fail base on vlc !! must install vlc !!
JetBrains/compose-multiplatform#1088
can modify the project to support Cmake build & kotlin
THX
开启垂直同步, 输出帧率小于视频文件帧率的时候, 没有丢帧去追赶音频, 会导致视频画面滞后, 音视频不同步
fanplayer使用的ffmpeg版本可以更新到4.3吗?这样很多新功能也能使用,比如播放srt或者av1之类的
Do you have plan to support SSL
rtspserver over tcp 和rtsp onver udp都会如此。wifi环境中测试。rtspserver关掉几次,有时候再打开,发现很久,fanplayer都没有恢复正常播放。
Thanks man for great job.
#!/bin/bash
set -e
PREFIX_DIR=$PWD/ffmpeg-android-sdk
SYSROOT=$NDK_HOME/platforms/android-21/arch-arm64/
CROSS_COMPILE=$NDK_HOME/toolchains/aarch64-linux-android-4.9/prebuilt/darwin-x86_64/bin/aarch64-linux-android-
EXTRA_CFLAGS="-I$PREFIX_DIR/include -DANDROID -DNDEBUG -Os -ffast-math -O3 -march=armv8-a"
EXTRA_LDFLAGS="-L$PREFIX_DIR/lib/"
#++ build ffmpeg ++#
if [ ! -d ffmpeg ]; then
git clone -b fanplayer-n3.3.x https://github.com/rockcarry/ffmpeg
fi
cd ffmpeg
./configure
--pkg-config=pkg-config
--arch=arm64
--cpu=armv8-a
--target-os=android
--disable-runtime-cpudetect
--enable-cross-compile
--cross-prefix=$CROSS_COMPILE
--sysroot=$SYSROOT
--prefix=$PREFIX_DIR/armv8-a
--enable-thumb
--enable-static
--enable-small
--disable-shared
--disable-symver
--disable-debug
--disable-programs
--disable-doc
--disable-postproc
--disable-encoders
--disable-muxers
--disable-filters
--disable-swscale-alpha
--enable-encoder=mjpeg
--enable-encoder=apng
--enable-encoder=aac
--enable-muxer=mjpeg
--enable-muxer=apng
--enable-muxer=mp4
--enable-muxer=flv
--enable-muxer=avi
--enable-filter=yadif
--enable-filter=rotate
--enable-asm
--enable-gpl
--enable-version3
--enable-nonfree
--enable-jni
--enable-mediacodec
--enable-decoder=h264_mediacodec
--enable-decoder=hevc_mediacodec
--enable-decoder=mpeg2_mediacodec
--enable-decoder=mpeg4_mediacodec
--enable-decoder=vp8_mediacodec
--enable-decoder=vp9_mediacodec
--extra-cflags="$EXTRA_CFLAGS"
--extra-ldflags="$EXTRA_LDFLAGS"
make -j8 && make install
cd -
#++ build ffmpeg ++#
echo done
And then try to build fanplayer
just i change application.mk file ---> APP_ABI := arm64-v8a
and build but error appear
/ffmpeg/lib/libavformat.a: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
***Full buidl log
building fanplayer jni library using ndk...
[arm64-v8a] Compile : fanplayer_jni <= ffplayer.c
/Users/BlackBird/f/pa/jni/../../src/ffplayer.c: In function 'init_stream':
/Users/BlackBird/f/pa/jni/../../src/ffplayer.c:227:9: warning: 'codec' is deprecated (declared at /Users/BlackBird/f/pa/jni/../ffmpeg/include/libavformat/avformat.h:893) [-Wdeprecated-declarations]
if (player->avformat_context->streams[i]->codec->codec_type == type) {
^
/Users/BlackBird/f/pa/jni/../../src/ffplayer.c:236:9: warning: 'codec' is deprecated (declared at /Users/BlackBird/f/pa/jni/../ffmpeg/include/libavformat/avformat.h:893) [-Wdeprecated-declarations]
player->acodec_context = player->avformat_context->streams[idx]->codec;
^
/Users/BlackBird/f/pa/jni/../../src/ffplayer.c:250:9: warning: 'codec' is deprecated (declared at /Users/BlackBird/f/pa/jni/../ffmpeg/include/libavformat/avformat.h:893) [-Wdeprecated-declarations]
player->vcodec_context = player->avformat_context->streams[idx]->codec;
^
/Users/BlackBird/f/pa/jni/../../src/ffplayer.c: In function 'get_stream_total':
/Users/BlackBird/f/pa/jni/../../src/ffplayer.c:308:9: warning: 'codec' is deprecated (declared at /Users/BlackBird/f/pa/jni/../ffmpeg/include/libavformat/avformat.h:893) [-Wdeprecated-declarations]
if (player->avformat_context->streams[i]->codec->codec_type == type) {
^
/Users/BlackBird/f/pa/jni/../../src/ffplayer.c: In function 'audio_decode_thread_proc':
/Users/BlackBird/f/pa/jni/../../src/ffplayer.c:641:13: warning: 'avcodec_decode_audio4' is deprecated (declared at /Users/BlackBird/f/pa/jni/../ffmpeg/include/libavcodec/avcodec.h:4852) [-Wdeprecated-declarations]
consumed = avcodec_decode_audio4(player->acodec_context, &player->aframe, &gotaudio, packet);
^
/Users/BlackBird/f/pa/jni/../../src/ffplayer.c: In function 'video_decode_thread_proc':
/Users/BlackBird/f/pa/jni/../../src/ffplayer.c:714:13: warning: 'avcodec_decode_video2' is deprecated (declared at /Users/BlackBird/f/pa/jni/../ffmpeg/include/libavcodec/avcodec.h:4901) [-Wdeprecated-declarations]
consumed = avcodec_decode_video2(player->vcodec_context, &player->vframe, &gotvideo, packet);
^
[arm64-v8a] Compile : fanplayer_jni <= ffrender.c
[arm64-v8a] Compile : fanplayer_jni <= pktqueue.c
[arm64-v8a] Compile : fanplayer_jni <= snapshot.c
/Users/BlackBird/f/pa/jni/../../src/snapshot.c: In function 'take_snapshot':
/Users/BlackBird/f/pa/jni/../../src/snapshot.c:78:5: warning: 'codec' is deprecated (declared at /Users/BlackBird/f/pa/jni/../ffmpeg/include/libavformat/avformat.h:893) [-Wdeprecated-declarations]
codec_ctxt = stream->codec;
^
/Users/BlackBird/f/pa/jni/../../src/snapshot.c:99:9: warning: 'avcodec_encode_video2' is deprecated (declared at /Users/BlackBird/f/pa/jni/../ffmpeg/include/libavcodec/avcodec.h:5416) [-Wdeprecated-declarations]
if (avcodec_encode_video2(codec_ctxt, &packet, &picture, &got) < 0) {
^
[arm64-v8a] Compile : fanplayer_jni <= recorder.c
/Users/BlackBird/f/pa/jni/../../src/recorder.c: In function 'recorder_init':
/Users/BlackBird/f/pa/jni/../../src/recorder.c:40:9: warning: 'codec' is deprecated (declared at /Users/BlackBird/f/pa/jni/../ffmpeg/include/libavformat/avformat.h:893) [-Wdeprecated-declarations]
AVStream *os = avformat_new_stream(recorder->ofc, is->codec->codec);
^
/Users/BlackBird/f/pa/jni/../../src/recorder.c:46:9: warning: 'avcodec_copy_context' is deprecated (declared at /Users/BlackBird/f/pa/jni/../ffmpeg/include/libavcodec/avcodec.h:4326) [-Wdeprecated-declarations]
ret = avcodec_copy_context(os->codec, is->codec);
^
/Users/BlackBird/f/pa/jni/../../src/recorder.c:46:9: warning: 'codec' is deprecated (declared at /Users/BlackBird/f/pa/jni/../ffmpeg/include/libavformat/avformat.h:893) [-Wdeprecated-declarations]
/Users/BlackBird/f/pa/jni/../../src/recorder.c:46:9: warning: 'codec' is deprecated (declared at /Users/BlackBird/f/pa/jni/../ffmpeg/include/libavformat/avformat.h:893) [-Wdeprecated-declarations]
/Users/BlackBird/f/pa/jni/../../src/recorder.c:52:9: warning: 'codec' is deprecated (declared at /Users/BlackBird/f/pa/jni/../ffmpeg/include/libavformat/avformat.h:893) [-Wdeprecated-declarations]
os->codec->codec_tag = 0;
^
/Users/BlackBird/f/pa/jni/../../src/recorder.c:54:13: warning: 'codec' is deprecated (declared at /Users/BlackBird/f/pa/jni/../ffmpeg/include/libavformat/avformat.h:893) [-Wdeprecated-declarations]
os->codec->flags |= AV_CODEC_FLAG_GLOBAL_HEADER;
^
[arm64-v8a] Compile : fanplayer_jni <= adev-cmn.c
[arm64-v8a] Compile : fanplayer_jni <= vdev-cmn.c
[arm64-v8a] Compile++ : fanplayer_jni <= adev-android.cpp
[arm64-v8a] Compile++ : fanplayer_jni <= vdev-android.cpp
[arm64-v8a] Compile++ : fanplayer_jni <= fanplayer_jni.cpp
[arm64-v8a] SharedLibrary : libfanplayer_jni.so
/Users/BlackBird/f/pa/jni/../ffmpeg/lib/libavformat.a: error adding symbols: File in wrong format
collect2: error: ld returned 1 exit status
make: *** [/Users/BlackBird/f/pa/obj/local/arm64-v8a/libfanplayer_jni.so] Error 1
windows 10, x86,vs2019编译
It looks like render-dev is NULL when this line gets called
render_getparam(player->render, PARAM_VDEV_GET_D3DDEV, &d3ddev);
so hw accel never works
How should I resolve this question
Hello Sir. I'm a UI/UX and Graphics Designer. I want provide a logo for you. Would you mind if I propose a new logo design for your project as my Open Source Contribution?
Thanks before.
我找到mediacodic 0 copy,但是不确定是否可以加入到我们这边来 可以帮忙确认一下吗https://gitlab.xinghuolive.com/lizhenyu/qtav/commit/cbab79e3485f064d756b912c2e690d434275de8f
Have your library crash when you update version or key or something ??
我的需求是这样的,RTSP流里面有SEI帧,里面有人或者其他物体的检测结果。
现在我能够读取sei帧,不知道在哪里显示。
在Qt的Paint消息里绘制会被视频给冲掉,完全看不到,只能在视频渲染部分添加了。
在这个vdev-d3d.c里 static void d3d_draw_surf(VDEVD3DCTXT *c, LPDIRECT3DSURFACE9 surf)函数里,模仿你的代码写的绘制函数没有效果。
对D3D和GDI不熟。请大神指教。
比如已知一个RECT r={10,10,100,100},怎么把r显示出来?
Please provide a link to binary that doesn’t need user to speak Chinese or have baidu account.
使用rtsp 解码播放时,做存储操作时 ret = avformat_write_header(recorder->ofc, NULL); 报错
服务端为rtspserver,wifi环境,rtsp over udp,全高清视频,同时打开vlc和fanplayer。很大概率,fanplayer播放没有vlc流畅,体验感略不如vlc
阅读代码到video_decode_thread_proc中,packet == null时调用render_video的意图不太理解,render_audio已经被注释了,render_video注释后好像也没有副作用。
sh .\build_fanplayer_jni.sh arm
HEAD is now at fd78df59b0 Prepare for 1.1.1k release
Configuring OpenSSL version 1.1.1k (0x101010bfL) for android-arm
Using os-specific seed configuration
no NDK arm-linux-androideabi-gcc on $PATH at (eval 7) line 124.
编译安卓版本的时候,无论怎么配置都是报上面错误,貌似是执行
命令行:./Configure no-shared $OPENSSL_TARGET -D__ANDROID_API__=21 --prefix=$PREFIX_DIR 这一步的时候报的错误
搞了好久没有编译通过,请教大神指点迷津了
在Windows上无法编译,提示gcc不能创建可执行文件(引起原因是build**.sh中把ndk写死为32位路径)。cygwin无法编译成功,改了64位ndk路径也无法编译成功。
在Ubuntu上,build**.sh也是相同提示,需要更改里面CROSS_COMPILE=$NDK_HOME/toolchains/arm-linux-androideabi-4.9/prebuilt/windows/bin/arm-linux-androideabi- 为Linux的路径,否则不能正常编译
When I try to close the player and the open the video, it something doesn’t show video (but the audio is working fine).
Sometime the program crash with the below log.
I am playing mkv file with 1080p resolution.
01-20 21:11:24.430 2111-2174/com.rockcarry.fanplayer E/Surface: dequeueBuffer failed (Operation not permitted)
01-20 21:11:24.430 2111-2174/com.rockcarry.fanplayer A/libc: Fatal signal 7 (SIGBUS) at 0x4159a913 (code=1), thread 2174 (carry.fanplayer)
I have add the stop button and add button to the example code.
private Button mBtnStop=null;
private Button mBtnOpen=null;
@Override
public void onCreate(Bundle savedInstanceState) {
//example code
mBtnStop=(Button)findViewById(R.id.btnStop);
mBtnStop.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
if(mIsPlaying) {
mPlayer.close();
mIsPlaying=false;
}
}
});
mBtnOpen=(Button)findViewById(R.id.btnOpen);
mBtnOpen.setOnClickListener(new View.OnClickListener()
{
@Override
public void onClick(View view){
mPlayer.open(mURL,"video_hwaccel=1;video_rotate=0");
}
});
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.