Giter Site home page Giter Site logo

rockcarry / fanplayer Goto Github PK

View Code? Open in Web Editor NEW
568.0 31.0 161.0 106.11 MB

A portable video player based on ffmpeg for windows and android platform.

License: GNU Lesser General Public License v3.0

Java 0.31% Shell 0.18% C 98.61% C++ 0.83% C# 0.07%
ffmpeg player ffmpeg-android ffmpeg-player mediaplayer video audio portable-video-player rtsp rtsp-player

fanplayer's People

Contributors

anharismail avatar dazuo0312 avatar rockcarry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

fanplayer's Issues

Android version compile completely but apk is crash when I run on simulator or android device.

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

对没有音频的文件播放帧率控制

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;
这里虽然有处理根据系统时间来判断,但是播放出来的效果是快进的。

android下,avcodec_open2调用失败

为了能够让播放器实现硬解,重新编译了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平板。

Store Locally function not working such as int player_snapshot(void *hplayer, char *file, int w, int h, int waitt) ,int player_record(void *hplayer, char *file)

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 ...!!!!!

why dxva dosn't work?

I play a local mp4 video. it only works on CPU,but not GPU.
I want to use GPU to play.

此工程ffmpeg 版本是多少?

您好,此工程的ffmpeg版本是多少,目前的ffmpeg 都不支持flv封装H265,我已经写好兼容。但是对于播放不是很清楚,想在你的工程中修改,但是通过替换ffmpeg 库的形式,ffplay找不到想要的方法。所以想知道你的ffmpeg的方法,或者能否进一步沟通

如何获取码流信息

void player_getparam(void *hplayer, int id, void *param);
这个函数可以获取吗?
比如编码类型H265,H264,帧率等信息?

Unable to play video (BadImageFormatException)

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?
file_dependency

Thank you in advance

播放1080P rtsp视频,底部有黑条

摄像头是海康的,视频编码是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也是空,如何保存图片?

Error while building ffmpeg library for android

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
    --> this results to the error no NDK arm-linux-androideabi-gcc on $PATH at (eval 10) line 124.
  • I changed the line 54 of the 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
    --> Now the the scripts continues but after a few seconds it results to the error ./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

fanplayer binary怎么播放直播

testplayer双击开只能打开本地视频,没有输

命令行传参数:
"
播放 rtmp 流媒体
testplayer rtmp://localhost:1983/live/test
"
这一步怎么搞

android中,close之后,重新播放,闪退

代码如下:

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();
}

调用上面函数,多次调用就会大概率闪退。有办法解决么?

支持网络视频实时播放吗?

正如标题所说的,fanplayer支持网络视频实时播放吗?
例如,有一个网络MP4文件https://file-examples-com.github.io/uploads/2017/04/file_example_MP4_480_1_5MG.mp4,能否使用
fanplayer直接播放,而不需要先下载这个mp4文件?

音视频同步问题

开启垂直同步, 输出帧率小于视频文件帧率的时候, 没有丢帧去追赶音频, 会导致视频画面滞后, 音视频不同步

ffmpeg版本更新

fanplayer使用的ffmpeg版本可以更新到4.3吗?这样很多新功能也能使用,比如播放srt或者av1之类的

fanplayer rtsp 重连有时候会失效

rtspserver over tcp 和rtsp onver udp都会如此。wifi环境中测试。rtspserver关掉几次,有时候再打开,发现很久,fanplayer都没有恢复正常播放。

build fanplayer for arm64-v8a

Thanks man for great job.

can you give me a hint about compile fanplayer.so for arm64,
I am a beginner in native but I try my hard to learn things !
I build ffmpeg from your script to arm64 after a hundred times>>> I think it's ok - can you correct me->>>
** BUILD FILE **

#!/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

HwAccel does not work

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

Logo Design Offer as Open Source Contribution

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.

求教如何在视频里画矩形框

我的需求是这样的,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显示出来?

render_video的用途是什么?

阅读代码到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和Ubuntu编译问题

在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的路径,否则不能正常编译

Crash with E/Surface: dequeueBuffer failed

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");

            }

        });
      
   }

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.