GithubHelp home page GithubHelp logo

matham / ffpyplayer Goto Github PK

View Code? Open in Web Editor NEW
132.0 15.0 37.0 28.61 MB

A cython implementation of an ffmpeg based player.

License: GNU Lesser General Public License v3.0

Makefile 0.06% Python 6.26% C 2.13% Shell 4.55% Cython 87.01%
python ffmpeg video-player

ffpyplayer's Introduction

FFPyPlayer is a python binding for the FFmpeg library for playing and writing media files.

For more information: https://matham.github.io/ffpyplayer/index.html

To install: https://matham.github.io/ffpyplayer/installation.html

TravisCI status Appveyor status Supported Python versions Latest Version on PyPI

Warning

Although the ffpyplayer source code is licensed under the LGPL, the ffpyplayer wheels for Windows and linux on PYPI are distributed under the GPL because the included FFmpeg binaries were compiled with GPL options.

If you want to use it under the LGPL you need to compile FFmpeg yourself with the correct options.

Similarly, the wheels bundle openssl for online camera support. However, releases are not made for every openssl release, so it is recommended that you compile ffpyplayer yourself if security is a issue.

Usage example

Playing a file:

>>> from ffpyplayer.player import MediaPlayer
>>> import time

>>> player = MediaPlayer(filename)
>>> val = ''
>>> while val != 'eof':
...     frame, val = player.get_frame()
...     if val != 'eof' and frame is not None:
...         img, t = frame
...         # display img

Writing a video file:

>>> from ffpyplayer.writer import MediaWriter
>>> from ffpyplayer.pic import Image

>>> w, h = 640, 480
>>> # write at 5 fps.
>>> out_opts = {'pix_fmt_in':'rgb24', 'width_in':w, 'height_in':h,
...     'codec':'rawvideo', 'frame_rate':(5, 1)}
>>> writer = MediaWriter('output.avi', [out_opts])

>>> # Construct image
>>> size = w * h * 3
>>> buf = bytearray([int(x * 255 / size) for x in range(size)])
>>> img = Image(plane_buffers=[buf], pix_fmt='rgb24', size=(w, h))

>>> for i in range(20):
...     writer.write_frame(img=img, pts=i / 5., stream=0)

Converting images:

>>> from ffpyplayer.pic import Image, SWScale
>>> w, h = 500, 100
>>> size = w * h * 3
>>> buf = bytearray([int(x * 255 / size) for x in range(size)])

>>> img = Image(plane_buffers=[buf], pix_fmt='rgb24', size=(w, h))
>>> sws = SWScale(w, h, img.get_pixel_format(), ofmt='yuv420p')

>>> img2 = sws.scale(img)
>>> img2.get_pixel_format()
'yuv420p'
>>> planes = img2.to_bytearray()
>>> map(len, planes)
[50000, 12500, 12500, 0]

ffpyplayer's People

Contributors

bwoodsend avatar cclauss avatar charrea6 avatar ewouth avatar germn avatar jeroenpeters1986 avatar matham avatar misl6 avatar rnixx avatar tigarmo avatar tito avatar tmiller02 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

ffpyplayer's Issues

Audio Waveform Data

First of all, thank you very much for this wrapper, I've been trying out multiple audio player python libraries, and none of them worked as intended on 64-bit Windows 10 for MP3 files. As a last resort, I was thinking about writing my own FFPLAY wrapper and calling it as a subprocess, when I came across this gem.

I would like to know if it was possible to receive the audio data similarly to

frame, val = player.get_frame()

I would like to plot the waveform of the MP3 file, but I've found no functions that allow me to get the data to do so.

Thank you in advance!

ffpyplayer fails to build with buildozer

Buildozer is failing to build ffpyplayer:

$ pip show cython
Name: Cython
Version: 0.28.5

I have specified in the buildozer spec a few different versions - v4.1.0 and master

ffpyplayer==v4.1.0, ffpyplayer_codecs

ffpyplayer, ffpyplayer_codecs

Both are failing to build - SDL2 errors:

ffpyplayer/pic.c:570:23: fatal error: SDL_mixer.h: No such file or directory
#include "SDL_mixer.h"
^
compilation terminated.
error: command 'arm-linux-androideabi-gcc' failed with exit status 1
[INFO]: STDERR:

Pyinstaller fails to package dlls

I tried to create an executable under 64-bit Windows 10, but it failed to find the DLLs required by ffpyplayer.
I've downloaded them with the FFMPEG Windows 64-bit distribution (and found SDL2_mixer.dll online at a random site), put them into a folder and declared it as a path to pyinstaller. There were no missing DLL warnings this time, but the executable has failed to run. I've tried manually overwriting the created ffpyplayer folder with the one in site-packages, and tried copy-pasting all the DLLs into its folder (and also the player's folder) together with the FFMPEG and FFPLAY executables. I still get the following error:

Traceback (most recent call last):
File "editor.pyw", line 25, in
File "c:\python3\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.dict)
File "libs\mp3.py", line 1, in
File "c:\python3\lib\site-packages\PyInstaller\loader\pyimod03_importers.py", line 627, in exec_module
exec(bytecode, module.dict)
File "site-packages\ffpyplayer\player_init_.py", line 10, in
ImportError: DLL load failed: A megadott modul nem található.
[22824] Failed to execute script editor

Any idea on how to overcome this problem?

The pyinstaller command is simply:

pyinstaller.exe -c -F -i icon.ico --paths ffmpeg\ --onedir --log-level=DEBUG editor.pyw

ffpyplayer compiling error

I am trying to compile and install ffpyplayer and am encountering a problem, the same problem is encounter with the master release too.

sbja@sbj:~/Documents/kivy/ffviddeo/ffpyplayer-master$ make
python setup.py build_ext --inplace
Selecting SDL2 out of (SDL, SDL2)
Generating ffconfig.h
Generating ffconfig.pxi
running build_ext
skipping 'ffpyplayer/pic.c' Cython extension (up-to-date)
building 'ffpyplayer.pic' extension
x86_64-linux-gnu-gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -I/usr/include/SDL2 -I/home/shubhangi/Documents/kivy/ffviddeo/ffpyplayer-master/ffpyplayer -I/home/shubhangi/Documents/kivy/ffviddeo/ffpyplayer-master/ffpyplayer/includes -I/usr/include/python2.7 -c ffpyplayer/pic.c -o build/temp.linux-x86_64-2.7/ffpyplayer/pic.o -O3 -fno-strict-aliasing -Wno-error
In file included from /usr/include/libavcodec/avcodec.h:38:0,
                 from /usr/include/libavformat/avformat.h:319,
                 from ffpyplayer/pic.c:447:
/usr/include/libavutil/frame.h:423:23: error: field ‘color_range’ has incomplete type
     enum AVColorRange color_range;
                       ^
/usr/include/libavutil/frame.h:425:27: error: field ‘color_primaries’ has incomplete type
     enum AVColorPrimaries color_primaries;
                           ^
/usr/include/libavutil/frame.h:427:40: error: field ‘color_trc’ has incomplete type
     enum AVColorTransferCharacteristic color_trc;
                                        ^
/usr/include/libavutil/frame.h:434:23: error: field ‘colorspace’ has incomplete type
     enum AVColorSpace colorspace;
                       ^
/usr/include/libavutil/frame.h:436:27: error: field ‘chroma_location’ has incomplete type
     enum AVChromaLocation chroma_location;
                           ^
In file included from /usr/include/libavformat/avformat.h:319:0,
                 from ffpyplayer/pic.c:447:
/usr/include/libavcodec/avcodec.h:2448:27: error: field ‘color_primaries’ has incomplete type
     enum AVColorPrimaries color_primaries;
                           ^
/usr/include/libavcodec/avcodec.h:2455:40: error: field ‘color_trc’ has incomplete type
     enum AVColorTransferCharacteristic color_trc;
                                        ^
/usr/include/libavcodec/avcodec.h:2462:23: error: field ‘colorspace’ has incomplete type
     enum AVColorSpace colorspace;
                       ^
/usr/include/libavcodec/avcodec.h:2469:23: error: field ‘color_range’ has incomplete type
     enum AVColorRange color_range;
                       ^
/usr/include/libavcodec/avcodec.h:2476:27: error: field ‘chroma_sample_location’ has incomplete type
     enum AVChromaLocation chroma_sample_location;
                           ^
In file included from /usr/include/libavformat/avformat.h:319:0,
                 from ffpyplayer/pic.c:447:
/usr/include/libavcodec/avcodec.h:4152:40: error: field ‘color_range’ has incomplete type
     enum AVColorRange                  color_range;
                                        ^
/usr/include/libavcodec/avcodec.h:4153:40: error: field ‘color_primaries’ has incomplete type
     enum AVColorPrimaries              color_primaries;
                                        ^
/usr/include/libavcodec/avcodec.h:4154:40: error: field ‘color_trc’ has incomplete type
     enum AVColorTransferCharacteristic color_trc;
                                        ^
/usr/include/libavcodec/avcodec.h:4155:40: error: field ‘color_space’ has incomplete type
     enum AVColorSpace                  color_space;
                                        ^
/usr/include/libavcodec/avcodec.h:4156:40: error: field ‘chroma_location’ has incomplete type
     enum AVChromaLocation              chroma_location;
                                        ^
In file included from ffpyplayer/pic.c:447:0:
/usr/include/libavformat/avformat.h:2444:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int’
 int avformat_write_header(AVFormatContext *s, AVDictionary **options);
 ^
/usr/include/libavformat/avformat.h:2466:1: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘int’
 int avformat_init_output(AVFormatContext *s, AVDictionary **options);
 ^
ffpyplayer/pic.c: In function ‘__pyx_f_10ffpyplayer_3pic_av_opt_set_int_list’:
ffpyplayer/pic.c:2707:3: warning: implicit declaration of function ‘av_int_list_length_for_size’ [-Wimplicit-function-declaration]
   __pyx_t_1 = ((av_int_list_length_for_size(__pyx_v_val_deref_size, __pyx_v_val, __pyx_v_term) > (INT_MAX / __pyx_v_val_deref_size)) != 0);
   ^
ffpyplayer/pic.c: At top level:
ffpyplayer/pic.c:3120:159: warning: ‘struct AVFilterGraph’ declared inside parameter list [enabled by default]
 static CYTHON_INLINE int __pyx_f_10ffpyplayer_3pic_insert_filt(char const *__pyx_v_name, char const *__pyx_v_arg, struct AVFilterGraph *__pyx_v_graph, struct AVFilterContext **__pyx_v_last_filter) {
                                                                                                                                                               ^
ffpyplayer/pic.c:3120:159: warning: its scope is only this definition or declaration, which is probably not what you want [enabled by default]
ffpyplayer/pic.c: In function ‘__pyx_f_10ffpyplayer_3pic_insert_filt’:
ffpyplayer/pic.c:3133:3: warning: implicit declaration of function ‘avfilter_graph_create_filter’ [-Wimplicit-function-declaration]
   __pyx_v_ret = avfilter_graph_create_filter((&__pyx_v_filt_ctx), avfilter_get_by_name(__pyx_v_name), __pyx_v_name, __pyx_v_arg, NULL, __pyx_v_graph);
   ^
ffpyplayer/pic.c: In function ‘__pyx_pf_10ffpyplayer_3pic_11ImageLoader___cinit__’:
ffpyplayer/pic.c:9278:53: error: ‘AVStream’ has no member named ‘codec’
   __pyx_t_9 = (__pyx_v_self->format_ctx->streams[0])->codec;
                                                     ^
ffpyplayer/pic.c: In function ‘__pyx_pf_10ffpyplayer_3pic_11ImageLoader_2__dealloc__’:
ffpyplayer/pic.c:9725:9: warning: implicit declaration of function ‘av_free_packet’ [-Wimplicit-function-declaration]
         av_free_packet((&__pyx_v_self->pkt));
         ^
ffpyplayer/pic.c: In function ‘__pyx_f_10ffpyplayer_3pic_11ImageLoader_next_frame’:
ffpyplayer/pic.c:10307:9: warning: ‘avcodec_decode_video2’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:4901) [-Wdeprecated-declarations]
         __pyx_v_ret = avcodec_decode_video2(__pyx_v_self->codec_ctx, __pyx_v_self->frame, (&__pyx_v_frame_decoded), (&__pyx_v_self->pkt));
         ^
ffpyplayer/pic.c: In function ‘__pyx_f_10ffpyplayer_3pic_11ImageLoader_eof_frame’:
ffpyplayer/pic.c:10709:9: warning: ‘avcodec_decode_video2’ is deprecated (declared at /usr/include/libavcodec/avcodec.h:4901) [-Wdeprecated-declarations]
         __pyx_v_ret = avcodec_decode_video2(__pyx_v_self->codec_ctx, __pyx_v_self->frame, (&__pyx_v_frame_decoded), (&__pyx_v_self->pkt));
         ^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
make: *** [build] Error 1
sbja@sbj:~/Documents/kivy/ffviddeo/ffpyplayer-master$ 

Python 2.7.6
Cython version 0.23

ffmpeg version 2.8.6 Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04.3)
configuration: --prefix=/home/shubhangi/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/shubhangi/ffmpeg_build/include --extra-ldflags=-L/home/shubhangi/ffmpeg_build/lib --bindir=/home/shubhangi/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100

Any help?

Crash while playing audio

With ffpyplayer on Windows 10 Python 3.6, I try running the following program on ogg or wav files:

from ffpyplayer.player import MediaPlayer

vid = 'arcade/examples/sounds/phaseJump1.ogg'
player = MediaPlayer(vid)
val = ''

while val != 'eof':
    frame, val = player.get_frame()

print("Done")

The sound is played, but at the end of the sound python crashes and I get: Process finished with exit code -1073741819 (0xC0000005)

Error when installing from pip .zip: `IOError: [Errno 2] No such file or directory: 'ffpyplayer/includes/ffconfig.h'`

Hi, when trying to install from the .zip provided the following error occurs:

$ pip install ffpyplayer
Collecting ffpyplayer
  Downloading ffpyplayer-4.0.0.zip (714kB)
    100% |████████████████████████████████| 716kB 1.6MB/s 
    Complete output from command python setup.py egg_info:
    Selecting SDL2 out of (SDL, SDL2)
    Generating ffconfig.h
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/private/var/folders/07/2n1y__gd1x7f1q5jy939k8dr0000gn/T/pip-build-u8WkdJ/ffpyplayer/setup.py", line 220, in <module>
        with open(join('ffpyplayer', 'includes', 'ffconfig.h'), 'w') as f:
    IOError: [Errno 2] No such file or directory: 'ffpyplayer/includes/ffconfig.h'

Error on building FFPYPLAYER for VideoPlayer Widget

Hi,

Need help…
I’m trying to build an Android APK with Kivy VideoPlayer and Video Widgets
But get a ffplayer error

Here is my buildozer.spec file
https://pastebin.com/xeEJX9PB

I have tried on OSX Sierra and it's the same error appears on the Buildozer VM build.

Some comments :

  • the videos work fine in Kivy Launcher
  • if i build without ffmepg or ffpyplayer the app is build but VideoPlayer don't work
  • I even try with different Cython version downgrade but no luck

Any idea?


[INFO]: -> running configure --disable-everything --enable-parser=h264,aac --enab...(and 679 more)
working: See ./configure --help for available options. Exception in thread background thread for pid 51407:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 801, in __bootstrap_inner
self.run()
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 754, in run
self.__target(*self.__args, **self.__kwargs)
File "/Users/martial/Library/Python/2.7/lib/python/site-packages/sh.py", line 2170, in background_thread
handle_exit_code(exit_code)
File "/Users/martial/Library/Python/2.7/lib/python/site-packages/sh.py", line 1929, in fn
return self.command.handle_command_exit_code(exit_code)
File "/Users/martial/Library/Python/2.7/lib/python/site-packages/sh.py", line 672, in handle_command_exit_code
raise exc
ErrorReturnCode_1:

RAN: ./configure --disable-everything --enable-parser=h264,aac --enable-decoder=h263,h264,aac --disable-dxva2 --disable-vdpau --disable-vaapi --disable-dct --disable-symver --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc --enable-filter=aresample,resample,crop,adelay,volume --enable-protocol=file,http --enable-small --enable-hwaccels --enable-gpl --enable-pic --disable-static --enable-shared --target-os=android --cross-prefix=arm-linux-androideabi- --arch=arm --sysroot=/Users/martial/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm --enable-neon --prefix=/Users/martial/Documents/BuildozerProjects/CIP/.buildozer/android/platform/build/build/other_builds/ffmpeg/armeabi-v7a/ffmpeg

STDOUT:
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
./configure: line 3404: __disable_vdpau: command not found
Unknown option "--disable-dxva2".
See ./configure --help for available options.

STDERR:

Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 174, in _run_module_as_main
"main", fname, loader, pkg_name)
File "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/runpy.py", line 72, in run_code
exec code in run_globals
File "/Users/martial/Documents/BuildozerProjects/CIP/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 916, in
main()
File "/Users/martial/Documents/BuildozerProjects/CIP/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 913, in main
ToolchainCL()
File "/Users/martial/Documents/BuildozerProjects/CIP/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 514, in init
getattr(self, args.subparser_name.replace('-', '
'))(args)
File "/Users/martial/Documents/BuildozerProjects/CIP/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 147, in wrapper_func
build_dist_from_args(ctx, dist, args)
File "/Users/martial/Documents/BuildozerProjects/CIP/.buildozer/android/platform/python-for-android-master/pythonforandroid/toolchain.py", line 192, in build_dist_from_args
build_recipes(build_order, python_modules, ctx)
File "pythonforandroid/build.py", line 572, in build_recipes
File "/Users/martial/Documents/BuildozerProjects/CIP/.buildozer/android/platform/python-for-android-master/pythonforandroid/recipes/ffmpeg/init.py", line 132, in build_arch
shprint(configure, *flags, _env=env)
File "pythonforandroid/logger.py", line 175, in shprint
File "/Users/martial/Library/Python/2.7/lib/python/site-packages/sh.py", line 720, in next
self.wait()
File "/Users/martial/Library/Python/2.7/lib/python/site-packages/sh.py", line 651, in wait
self.handle_command_exit_code(exit_code)
File "/Users/martial/Library/Python/2.7/lib/python/site-packages/sh.py", line 672, in handle_command_exit_code
raise exc
sh.ErrorReturnCode_1:

RAN: ./configure --disable-everything --enable-parser=h264,aac --enable-decoder=h263,h264,aac --disable-dxva2 --disable-vdpau --disable-vaapi --disable-dct --disable-symver --disable-ffmpeg --disable-ffplay --disable-ffprobe --disable-ffserver --disable-doc --enable-filter=aresample,resample,crop,adelay,volume --enable-protocol=file,http --enable-small --enable-hwaccels --enable-gpl --enable-pic --disable-static --enable-shared --target-os=android --cross-prefix=arm-linux-androideabi- --arch=arm --sysroot=/Users/martial/.buildozer/android/platform/android-ndk-r9c/platforms/android-19/arch-arm --enable-neon --prefix=/Users/martial/Documents/BuildozerProjects/CIP/.buildozer/android/platform/build/build/other_builds/ffmpeg/armeabi-v7a/ffmpeg

STDOUT:
tput: No value for $TERM and no -T specified
tput: No value for $TERM and no -T specified
./configure: line 3404: __disable_vdpau: command not found
Unknown option "--disable-dxva2".
See ./configure --help for available options.

STDERR:

Command failed: /Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -m pythonforandroid.toolchain create --dist_name=cip --bootstrap=sdl2 --requirements=kivy,python2,hostpython2,ffpyplayer --arch armeabi-v7a --copy-libs --color=always --storage-dir=/Users/martial/Documents/BuildozerProjects/CIP/.buildozer/android/platform/build

Buildozer failed to execute the last command

The error might be hidden in the log above this error

Please read the full log, and search for it before

raising an issue with buildozer itself.

In case of a bug report, please add a full log with log_level = 2


When tweaking the FFMPEG recipe by removing those flags

                '--disable-dxva2 --disable-vdpau --disable-vaapi',
                '--disable-dct',

I get this error
https://pastebin.com/MbkMCdXb

Thanks
Regards,

Error calling SWScale using Visual Studio Code

Hello

I'm a newbie, using Visual Studio Code to try to get a little ffpyplayer movie player together in the hope of using it in a more advanced way going forward.

Partly based on the code from https://matham.github.io/ffpyplayer/examples.html#saving-an-image-to-disk , I've got a media player instance running, and I can hear the audio playing from the file- but getting an image out of it is causing me problems.

The chunk of my code is below- it's just a prototype, aiming to get just one image out of the file, but when it hits the last line, img2 = sws.scale(img), it's throwing this unusual error:
Unable to open pic.pyx: Unable to read file (Error: File not found (c:\users\[...]\documents\pythontests\ffpyplayer\pic.pyx))

I'm not sure why it would be looking in the project's path for this ffpyplayer file? Might this be a config issue, or a bug? I'm new to Python so I fear I may be misdiagnosing the problem.

All the libraries I've installed have been through pip install etc.

Any help or pointers would be appreciated, if this isn't a bug.

Thanks

Stuart

player = MediaPlayer(filename) val = '' while val != 'eof': frame, val = player.get_frame() if val != 'eof' and frame is not None: img, t = frame pictureBox = tk.Tk() w = 640 h = 360 sws = SWScale(w, h, img.get_pixel_format(), w, h) img2 = sws.scale(img)

Duplicated symbol on OSX

On OSX, i use Kivy compiled on my own, and pip installed ffpyplayer.
Everytime i start Kivy with KIVY_VIDEO=ffpyplayer, it shows:

objc[26207]: Class SDLApplication is implemented in both /Library/Frameworks/SDL2.framework/Versions/A/SDL2 (0x108e41378) and /Users/tito/miniconda3/envs/kivy/lib/python3.6/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x10aee6170). One of the two will be used. Which one is undefined.
objc[26207]: Class SDLAppDelegate is implemented in both /Library/Frameworks/SDL2.framework/Versions/A/SDL2 (0x108e413c8) and /Users/tito/miniconda3/envs/kivy/lib/python3.6/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x10aee61c0). One of the two will be used. Which one is undefined.
objc[26207]: Class SDLTranslatorResponder is implemented in both /Library/Frameworks/SDL2.framework/Versions/A/SDL2 (0x108e41440) and /Users/tito/miniconda3/envs/kivy/lib/python3.6/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x10aee6238). One of the two will be used. Which one is undefined.
objc[26207]: Class SDLMessageBoxPresenter is implemented in both /Library/Frameworks/SDL2.framework/Versions/A/SDL2 (0x108e41648) and /Users/tito/miniconda3/envs/kivy/lib/python3.6/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x10aee6260). One of the two will be used. Which one is undefined.
objc[26207]: Class SDL_cocoametalview is implemented in both /Library/Frameworks/SDL2.framework/Versions/A/SDL2 (0x108e41328) and /Users/tito/miniconda3/envs/kivy/lib/python3.6/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x10aee62b0). One of the two will be used. Which one is undefined.
objc[26207]: Class SDLOpenGLContext is implemented in both /Library/Frameworks/SDL2.framework/Versions/A/SDL2 (0x108e41468) and /Users/tito/miniconda3/envs/kivy/lib/python3.6/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x10aee6300). One of the two will be used. Which one is undefined.
objc[26207]: Class SDLWindow is implemented in both /Library/Frameworks/SDL2.framework/Versions/A/SDL2 (0x108e414b8) and /Users/tito/miniconda3/envs/kivy/lib/python3.6/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x10aee6350). One of the two will be used. Which one is undefined.
objc[26207]: Class Cocoa_WindowListener is implemented in both /Library/Frameworks/SDL2.framework/Versions/A/SDL2 (0x108e414e0) and /Users/tito/miniconda3/envs/kivy/lib/python3.6/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x10aee6378). One of the two will be used. Which one is undefined.
objc[26207]: Class SDLView is implemented in both /Library/Frameworks/SDL2.framework/Versions/A/SDL2 (0x108e41558) and /Users/tito/miniconda3/envs/kivy/lib/python3.6/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x10aee63f0). One of the two will be used. Which one is undefined.
objc[26207]: Class METAL_RenderData is implemented in both /Library/Frameworks/SDL2.framework/Versions/A/SDL2 (0x108e415a8) and /Users/tito/miniconda3/envs/kivy/lib/python3.6/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x10aee6440). One of the two will be used. Which one is undefined.
objc[26207]: Class METAL_TextureData is implemented in both /Library/Frameworks/SDL2.framework/Versions/A/SDL2 (0x108e415f8) and /Users/tito/miniconda3/envs/kivy/lib/python3.6/site-packages/ffpyplayer/.dylibs/libSDL2-2.0.0.dylib (0x10aee6490). One of the two will be used. Which one is undefined.

pip install fails Ubuntu/LM18

I know this is similiar but I want to point out that the error is in the setup.py file and fails consistently making it very difficult to support ffpyplayer on Android. Failed both with Buildozer and P4A setup.py. But pip installs from github directly; or at least it managed to once.
I did follow and complete: https://github.com/matham/ffpyplayer/blob/master/.travis.yml#L20

Collecting ffpyplayer (from -r requirements.txt (line 2))
  Using cached ffpyplayer-4.0.0.zip
    Complete output from command python setup.py egg_info:
    Selecting SDL2 out of (SDL, SDL2)
    Generating ffconfig.h
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-build-O_gExg/ffpyplayer/setup.py", line 220, in <module>
        with open(join('ffpyplayer', 'includes', 'ffconfig.h'), 'w') as f:
    IOError: [Errno 2] No such file or directory: 'ffpyplayer/includes/ffconfig.h'
    
    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-O_gExg/ffpyplayer/

App crashes on iPhone simulator with ffpyplayer error

Kivy/Python program runs fine on Mac. Created an Xcode project with Kivy-ios toolchain. App runs fine on iPhone simulator, but when audio button is pushed, it crashes. Here is some simplified code which results in the same crash. This is the error Xcode gives after the app crashes on the iPhone simulator:

File "ffpyplayer/player.pyx", line 203, in 
ffpyplayer.player.MediaPlayer.__cinit__   TypeError: __cinit__()
takes at least 2 positional arguments (1 given)
import os

os.environ['KIVY_AUDIO'] = 'ffpyplayer'
from kivy.app import App
from kivy.uix.button import Button
from kivy.uix.gridlayout import GridLayout
from ffpyplayer.player import MediaPlayer

import kivy, time

class MainScreen(GridLayout):
    def __init__(self, **kwargs):
        super(MainScreen, self).__init__(**kwargs)
        self.cols = 2
        self.row = 1
        self.hello = Button(text="play the audio")
        self.hello.bind(on_press=self.playit)
        self.add_widget(self.hello)

    def playit(self, *args):
        audiofiletoload = "hours.ogg"
        self.newplayer = MediaPlayer(audiofiletoload)
        time.sleep(0.1)
        self.newplayer.seek(30, relative=False, accurate=False)
        time.sleep(2.0)
        self.newplayer.close_player()

class MyApp(App):
    def build(self):
        return MainScreen()

if __name__ == '__main__':
    MyApp().run()

Build for Android - iOS: Could not find suitable distribution for Requirement.parse('cython')

Versions

  • Python: 3.7.1
  • OS: MacOS 10.13.6
  • Kivy: 1.10.1
  • FFPyplayer: 4.1.0

Description

It check cython don't exist and exits. But I change it to ['cython'] if have_cython else [] it work again.

setup_requires=['cython'])

Logs

[INFO    ] Running Shell: /Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/hostpython3/bin/python ('setup.py', 'build_ext', '-g') 
{'_env': {'HAS_SDL2': '1', 'LD': u'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld', 'USE_SDL2_MIXER': '1', 'LDFLAGS': u'-arch x86_64 --sysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk -L/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/lib -lsqlite3 -miphoneos-version-min=8.0', 'KIVYIOSROOT': '/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios', 'CC': '/var/folders/vx/ywrxzl3n27q09h2psqlq4xk80000gn/T/tmpqwsnuI -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64/libffi -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/common/sdl2_mixer', 'OTHER_CFLAGS': '-I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64/ffi -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64/openssl -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64/ffmpeg -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64', 'FFMPEG_LIB_DIR': u'/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/build/ffmpeg/x86_64/ffmpeg-2.6.3/dist/lib', 'ARM_LD': u'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld', 'OTHER_LDFLAGS': '-L/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/lib', 'FFMPEG_INCLUDE_DIR': '/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64/ffmpeg', 'CXX': '/var/folders/vx/ywrxzl3n27q09h2psqlq4xk80000gn/T/tmpX4IHmn', 'AR': u'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar', 'SDL_INCLUDE_DIR': '/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/common/sdl2', 'CFLAGS': '-O3 -miphoneos-version-min=8.0 -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64/ffi -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64/openssl -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64/ffmpeg -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64 -Wno-implicit-function-declaration -fno-strict-aliasing', 'LDSHARED': '/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/tools/liblink', 'SDL_LIB_DIR': '/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/lib', 'ARCH': 'x86_64', 'IOSSDKROOT': u'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk'}, '_iter': True, '_out_bufsize': 1, '_err_to_out': True}
[DEBUG   ] Environ change has_sdl2 -> True
[DEBUG   ] Environ change use_sdl2_mixer -> True
[DEBUG   ] Generating ffconfig.h
[DEBUG   ] Generating ffconfig.pxi
[DEBUG   ] Download error on https://pypi.python.org/simple/cython/: unknown url type: https -- Some packages may not be found!
[DEBUG   ] Couldn't find index page for 'cython' (maybe misspelled?)
[DEBUG   ] Download error on https://pypi.python.org/simple/: unknown url type: https -- Some packages may not be found!
[DEBUG   ] No local packages or working download links found for cython
[DEBUG   ] Traceback (most recent call last):
[DEBUG   ]   File "setup.py", line 341, in <module>
[DEBUG   ]     setup_requires=['cython'])
[DEBUG   ]   File "/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/hostpython3/lib/python3.7/distutils/core.py", line 108, in setup
[DEBUG   ]     _setup_distribution = dist = klass(attrs)
[DEBUG   ]   File "/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/hostpython3/lib/python3.7/site-packages/setuptools/dist.py", line 317, in __init__
[DEBUG   ]     self.fetch_build_eggs(attrs['setup_requires'])
[DEBUG   ]   File "/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/hostpython3/lib/python3.7/site-packages/setuptools/dist.py", line 372, in fetch_build_eggs
[DEBUG   ]     replace_conflicting=True,
[DEBUG   ]   File "/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/hostpython3/lib/python3.7/site-packages/pkg_resources/__init__.py", line 846, in resolve
[DEBUG   ]     dist = best[req.key] = env.best_match(req, ws, installer)
[DEBUG   ]   File "/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/hostpython3/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1118, in best_match
[DEBUG   ]     return self.obtain(req, installer)
[DEBUG   ]   File "/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/hostpython3/lib/python3.7/site-packages/pkg_resources/__init__.py", line 1130, in obtain
[DEBUG   ]     return installer(requirement)
[DEBUG   ]   File "/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/hostpython3/lib/python3.7/site-packages/setuptools/dist.py", line 440, in fetch_build_egg
[DEBUG   ]     return cmd.easy_install(req)
[DEBUG   ]   File "/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/hostpython3/lib/python3.7/site-packages/setuptools/command/easy_install.py", line 668, in easy_install
[DEBUG   ]     raise DistutilsError(msg)
[DEBUG   ] distutils.errors.DistutilsError: Could not find suitable distribution for Requirement.parse('cython')

CPU hogging when loading images

Building a simple media browser using MediaPlayer, I noticed this when loading images (e.g. jpg, png). No issues with other media formats. I remember installing ffpyplayer using pip for python3.

After calling get_frame() once, some of the created threads started hogging the CPU way too much. Only cure for this was to close the player using close_player(). I couldn't debug well enough to find the root of this issue nor find anything helpful in the documentation to solve this.

Running this in the python3 interpreter, I can reproduce the issue easily

> from ffpyplayer.player import MediaPlayer
> player = MediaPlayer("test.jpg")
> player.get_frame()

Immidiately after this, CPU usage goes high. This happens with any python script, too.

Could this be a ffmpeg/build -related issue? Or have I missed something relevant regarding image loading? I can attach any additional information to help solve this issue.
Thanks!

I can not save image from a live video stream.

I tried the method of 'https://matham.github.io/ffpyplayer/examples.html#saving-an-image-to-disk'.

This is my code: player.txt

Traceback (most recent call last):
File "D:/wwwroot/wangyou/player.py", line 91, in
save()
File "D:/wwwroot/wangyou/player.py", line 80, in save
img = sws.scale(img)
File "ffpyplayer\pic.pyx", line 270, in ffpyplayer.pic.SWScale.scale (ffpyplayer\pic.c:4517)
Exception: Source image doesn't match the specified input parameters.
[swscaler @ 093a6e20] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 09528de0] deprecated pixel format used, make sure you did set range correctly

On shutdown with other errors

Good evening!
I found another issue. By using your demo app as ground. I'm having following errors.
The top errors you already know about. But those under it is new.
And as usual, take your time. I'm almost never in a hurry.

The call I was making came from my own library. But I'm not getting any errors from a basic Kivy app.

Edit: Looks differently in https://gist.github.com/kuzeyron/caba23a65ec06b1d348238518bcbc78b
But Error in sys.excepthook: doesn't seem to show up.
If you wonder if I'm using print(). Yes sometimes but left off normally.

[INFO   ] [Logger      ] Record log in /home/user/.kivy/logs/kivy_19-09-08_5.txt
[INFO   ] [Kivy        ] v1.11.0
[INFO   ] [Kivy        ] Installed at "/usr/lib/python3.7/site-packages/kivy/__init__.py"
[INFO   ] [Python      ] v3.7.4 (default, Jul 16 2019, 07:12:58) 
[GCC 9.1.0]
[INFO   ] [Python      ] Interpreter at "/usr/bin/python3"
[INFO   ] [Factory     ] 184 symbols loaded
[INFO   ] [ImageLoaderFFPy] Using ffpyplayer 4.3.0.dev0
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_ffpyplayer, img_gif 
[INFO   ] [Window      ] Provider: sdl2(['window_egl_rpi'] ignored)
[INFO   ] [GL          ] Using the "OpenGL" graphics system
[INFO   ] [GL          ] Backend used <sdl2>
[INFO   ] [GL          ] OpenGL version <b'3.0 Mesa 19.1.5'>
[INFO   ] [GL          ] OpenGL vendor <b'Intel Open Source Technology Center'>
[INFO   ] [GL          ] OpenGL renderer <b'Mesa DRI Intel(R) Haswell Mobile '>
[INFO   ] [GL          ] OpenGL parsed version: 3, 0
[INFO   ] [GL          ] Shading version <b'1.30'>
[INFO   ] [GL          ] Texture max size <16384>
[INFO   ] [GL          ] Texture max units <32>
[INFO   ] [Window      ] auto add sdl2 input provider
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [GL          ] NPOT texture support is available
[INFO   ] [ProbeSysfs  ] device match: /dev/input/event11
[INFO   ] [MTD         ] Read event from </dev/input/event11>
[INFO   ] [Base        ] Start application main loop
[INFO   ] [MTD         ] </dev/input/event11> range position X is 1232 - 5710
[INFO   ] [MTD         ] </dev/input/event11> range position Y is 1156 - 4696
[INFO   ] [MTD         ] </dev/input/event11> range touch major is 0 - 0
[INFO   ] [MTD         ] </dev/input/event11> range touch minor is 0 - 0
[INFO   ] [MTD         ] </dev/input/event11> range pressure is 0 - 255
[INFO   ] [MTD         ] </dev/input/event11> axes invertion: X is 0, Y is 0
[INFO   ] [MTD         ] </dev/input/event11> rotation set to 0
[INFO   ] [Generated background colors] 40 RGBA colors
[INFO   ] [Generated text colors] 40 RGBA colors
[INFO   ] [Reversed colors] No
[INFO   ] [WindowSDL   ] exiting mainloop and closing.
[INFO   ] [Base        ] Leaving application in progress...
[CRITICAL] [ffpyplayer  ] __call__() takes 1 positional argument but 3 were given
[CRITICAL] [ffpyplayer  ] Traceback (most recent call last):
  File "ffpyplayer/player/core.pyx", line 95, in ffpyplayer.player.core.read_thread_enter
  File "ffpyplayer/player/core.pyx", line 2231, in ffpyplayer.player.core.VideoState.read_thread
  File "ffpyplayer/player/core.pyx", line 2250, in ffpyplayer.player.core.VideoState.failed
  File "ffpyplayer/player/core.pyx", line 384, in ffpyplayer.player.core.VideoState.request_thread_s
  File "ffpyplayer/player/core.pyx", line 399, in ffpyplayer.player.core.VideoState.request_thread_py
TypeError: __call__() takes 1 positional argument but 3 were given
[CRITICAL] [ffpyplayer  ] __call__() takes 1 positional argument but 3 were given
[CRITICAL] [ffpyplayer  ] Traceback (most recent call last):
  File "ffpyplayer/player/core.pyx", line 135, in ffpyplayer.player.core.audio_thread_enter
  File "ffpyplayer/player/core.pyx", line 1047, in ffpyplayer.player.core.VideoState.audio_thread
  File "ffpyplayer/player/core.pyx", line 384, in ffpyplayer.player.core.VideoState.request_thread_s
  File "ffpyplayer/player/core.pyx", line 399, in ffpyplayer.player.core.VideoState.request_thread_py
TypeError: __call__() takes 1 positional argument but 3 were given
[CRITICAL] [ffpyplayer  ] __call__() takes 1 positional argument but 3 were given
[CRITICAL] [ffpyplayer  ] Traceback (most recent call last):
  File "ffpyplayer/player/core.pyx", line 115, in ffpyplayer.player.core.video_thread_enter
  File "ffpyplayer/player/core.pyx", line 1255, in ffpyplayer.player.core.VideoState.video_thread
  File "ffpyplayer/player/core.pyx", line 384, in ffpyplayer.player.core.VideoState.request_thread_s
  File "ffpyplayer/player/core.pyx", line 399, in ffpyplayer.player.core.VideoState.request_thread_py
TypeError: __call__() takes 1 positional argument but 3 were given
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:
Error in sys.excepthook:

Original exception was:

Question about compiling for Android

Currently looks like it's not possible to install ffpyplayer with python-for-android (since ffmpeg recipe is broken and ffpyplayer is not ported for new toolchain) and I'm trying to fix it.

Manual says that we need shared FFmpeg and SDL2 libs to compile ffpyplayer. In python-for-android project we have recipes for ffmpeg and sdl2, but both of them compile static libraries instead of shared.

On other hand, recipe for old toolchain used existed sdl recipe (with static lib) as dependency. I wounder if you know why it is so. May be old version of ffpyplayer could use static sdl lib?

I also wounder if you have any ideas how to install ffpyplayer with p4a now: am I right that we need new recipes for shared libraries for both ffmpeg and sdl2 (I mean that's no way to use existing ffmpeg/sdl2 static recipes)?

Thanks.

error compiling ffpyplayer

pulled the latest ffpyplayer and got this error compiling it ...

[ 1/10] Cythonizing ffpyplayer/player/clock.pyx
[ 2/10] Cythonizing ffpyplayer/player/core.pyx
[ 3/10] Cythonizing ffpyplayer/player/decoder.pyx
[ 4/10] Cythonizing ffpyplayer/player/frame_queue.pyx
[ 5/10] Cythonizing ffpyplayer/player/player.pyx
[ 6/10] Cythonizing ffpyplayer/player/queue.pyx
[ 7/10] Cythonizing ffpyplayer/threading.pyx
[ 8/10] Cythonizing ffpyplayer/tools.pyx
[ 9/10] Cythonizing ffpyplayer/pic.pyx
[10/10] Cythonizing ffpyplayer/writer.pyx
building 'ffpyplayer.pic' extension
gcc -pthread -fno-strict-aliasing -g -O2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -fPIC -I/usr/local/include -I/usr/local/include/SDL2 -I/usr/X11/include -I/v6/src2/ffpyplayer/ffpyplayer/ffpyplayer -I/v6/src2/ffpyplayer/ffpyplayer/ffpyplayer/includes -I/usr/local/include/python2.7 -c ffpyplayer/pic.c -o build/temp.linux-x86_64-2.7/ffpyplayer/pic.o -O3 -fno-strict-aliasing -Wno-error
ffpyplayer/pic.c: In function '__pyx_f_10ffpyplayer_3pic_5Image_to_memoryview':
ffpyplayer/pic.c:7930:52: error: '__pyx_array_type' undeclared (first use in this function)
       __pyx_t_3 = __Pyx_PyObject_Call(((PyObject *)__pyx_array_type), __pyx_emp
                                                    ^
ffpyplayer/pic.c:7930:52: note: each undeclared identifier is reported only once for each function it appears in
ffpyplayer/pic.c:7945:20: error: dereferencing pointer to incomplete type
       __pyx_v_cyarr->data = ((char *)(__pyx_v_self->frame->data[__pyx_v_i]));

ffpyplayer/pic.c:8120:30: error: dereferencing pointer to incomplete type
     __pyx_t_8 = __pyx_v_cyarr->data;
                              ^
ffpyplayer/pic.c: In function '__pyx_pf_10ffpyplayer_3pic_11ImageLoader___cinit__':
ffpyplayer/pic.c:8617:3: warning: 'codec' is deprecated (declared at /usr/include/libavformat/avformat.h:885) [-Wdeprecated-declarations]
   __pyx_t_9 = (__pyx_v_self->format_ctx->streams[0])->codec;
   ^
ffpyplayer/pic.c: In function '__pyx_pf_10ffpyplayer_3pic_11ImageLoader_2__dealloc__':
ffpyplayer/pic.c:9038:9: warning: 'av_free_packet' is deprecated (declared at /usr/include/libavcodec/avcodec.h:4471) [-Wdeprecated-declarations]
         av_free_packet((&__pyx_v_self->pkt));
         ^
ffpyplayer/pic.c: In function '__pyx_f_10ffpyplayer_3pic_11ImageLoader_next_frame':
ffpyplayer/pic.c:9620:9: warning: 'avcodec_decode_video2' is deprecated (declared at /usr/include/libavcodec/avcodec.h:4810) [-Wdeprecated-declarations]
         __pyx_v_ret = avcodec_decode_video2(__pyx_v_self->codec_ctx, __pyx_v_se
         ^
ffpyplayer/pic.c:9763:3: warning: 'av_free_packet' is deprecated (declared at /usr/include/libavcodec/avcodec.h:4471) [-Wdeprecated-declarations]
   av_free_packet((&__pyx_v_self->pkt));
   ^
ffpyplayer/pic.c: In function '__pyx_f_10ffpyplayer_3pic_11ImageLoader_eof_frame':
ffpyplayer/pic.c:10022:9: warning: 'avcodec_decode_video2' is deprecated (declared at /usr/include/libavcodec/avcodec.h:4810) [-Wdeprecated-declarations]
         __pyx_v_ret = avcodec_decode_video2(__pyx_v_self->codec_ctx, __pyx_v_se
         ^
error: command 'gcc' failed with exit status 1

My environments ...

python --version

Python 2.7.12

cython --version

Cython version 0.25a0

ffmpeg -version

ffmpeg version 3.0.git Copyright (c) 2000-2016 the FFmpeg developers
built with gcc 4.9.4 (GCC)
configuration: --enable-nonfree --enable-gpl --enable-avresample --enable-libmp3lame --enable-libx264 --enable-libvpx --disable-videotoolbox --enable-pic --enable-shared --disable-static

Pyinstaller packaging issues

When packaging a app that uses ffpyplaer, pyinstaller has issues with loading the internal modules (e.g. ffthreading) when loading e.g. ffpyplayer.player and fails.

The error is:

 Traceback (most recent call last):
   File "<string>", line 2, in <module>
   File "C:\kivy-build\PyInstaller-2.1\PyInstaller\loader\pyi_importers.py", line 270, in load_module
     exec(bytecode, module.__dict__)
   File "C:\Users\.\Documents\Eclipse\Filers\build\filers\out00-PYZ.pyz\filers.main", line 43, in <module>
   File "C:\kivy-build\PyInstaller-2.1\PyInstaller\loader\pyi_importers.py", line 270, in load_module
     exec(bytecode, module.__dict__)
   File "C:\Users\.\Documents\Eclipse\Filers\build\filers\out00-PYZ.pyz\filers.record", line 36, in <module>
   File "C:\kivy-build\PyInstaller-2.1\PyInstaller\loader\pyi_importers.py", line 409, in load_module
     module = imp.load_module(fullname, fp, filename, self._c_ext_tuple)
   File "ffthreading.pxd", line 9, in init ffpyplayer.player (ffpyplayer\player.c:7399)
 ImportError: No module named ffthreading

Looking at that line in player.c we have:

__pyx_ptype_10ffpyplayer_11ffthreading_MTCond = __Pyx_ImportType("ffpyplayer.ffthreading", "MTCond", sizeof(struct __pyx_obj_10ffpyplayer_11ffthreading_MTCond), 1); if (unlikely(!__pyx_ptype_10ffpyplayer_11ffthreading_MTCond)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;}

A way around is to add ffpyplayer in the exclude list, e.g.

a = Analysis([...], excludes=['ffpyplayer'])

and manually adding the ffpyplayer directory.

request_channel cordump

This is code

from ffpyplayer.player import MediaPlayer
mp = MediaPlayer('./a.mp4')
mp.request_channel('audio' ,action='open',requested_stream=-1)
mp.close_player()

when it run, it coredump

the "a.mp4" video file has two audio tracks

FFpyplayer in Raspberry Pi installation

Hi,
I'm trying to install FFPyplayer on Raspberry Pi 3 for the past few weeks, and it keeps failing. I'm frustrated beyond words with myself now. If someone can lend a hand, point me in right direction, or tell me the steps I'm missing, I'd be very very grateful.
Below are the steps I followed.

  • sudo apt-get -y install libsdl2-dev libsdl2-mixer-dev python-dev

  • mkdir ~/ffmpeg_sources

  • export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$HOME/ffmpeg_build/lib

  • sudo apt-get -y install yasm

  • cd ~/ffmpeg_sources

  • wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz

  • tar xzf yasm-1.3.0.tar.gz

  • cd yasm-1.3.0

  • ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/ffmpeg_build/bin"

  • make

  • make install

  • sudo apt-get -y install nasm

  • cd /home/pi/ffmpeg_sources

  • wget http://www.nasm.us/pub/nasm/releasebuilds/2.13.01/nasm-2.13.01.tar.xz

  • tar xf nasm-2.13.01.tar.xz

  • cd nasm-2.13.01

  • ./configure --prefix="/home/pi/ffmpeg_build" --bindir="/home/pi/ffmpeg_build/bin"

  • make

  • make install

  • sudo apt-get -y install libx264-dev

  • cd ~/ffmpeg_sources

  • wget http://download.videolan.org/pub/x264/snapshots/last_x264.tar.bz2

  • tar xjf last_x264.tar.bz2

  • cd x264-snapshot*

  • PATH="$HOME/ffmpeg_build/bin:$PATH" ./configure --prefix="$HOME/ffmpeg_build" --bindir="$HOME/ffmpeg_build/bin" --enable-shared --extra-cflags="-fPIC";

  • PATH="$HOME/ffmpeg_build/bin:$PATH" make

  • make install

  • sudo apt-get -y install libmp3lame-dev

  • sudo apt-get -y install nasm

  • cd ~/ffmpeg_sources

  • wget http://downloads.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz

  • tar xzf lame-3.99.5.tar.gz

  • cd lame-3.99.5

  • ./configure --prefix="$HOME/ffmpeg_build" --enable-nasm --enable-shared

  • make

  • make install

  • sudo apt-get -y install libass-dev libfreetype6-dev libtheora-dev libvorbis-dev

  • cd ~/ffmpeg_sources

  • wget http://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2

  • tar xjf ffmpeg-snapshot.tar.bz2

  • cd ffmpeg

  • PATH="$HOME/ffmpeg_build/bin:$PATH" PKG_CONFIG_PATH="$HOME/ffmpeg_build/lib/pkgconfig" ./configure --prefix="$HOME/ffmpeg_build" --extra-cflags="-I$HOME/ffmpeg_build/include -fPIC" --extra-ldflags="-L$HOME/ffmpeg_build/lib" --bindir="$HOME/ffmpeg_build/bin" --enable-gpl --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-shared;

  • PATH="$HOME/ffmpeg_build/bin:$PATH" make

  • make install

  • pip install --upgrade cython nose

  • pip install ffpyplayer

url play repeat last part a few times

url play repeat last part of the file a few times , a bug. tested with

filename = 'http://dict.youdao.com/dictvoice?audio=nice&type=1'
from ffpyplayer.player import MediaPlayer
player = MediaPlayer(filename)#, ff_opts={'autoexit': True}, 'loop': 2

Having trouble building in linux

When building from source in linux,

python setup.py install
WARNING: A problem occured while running pkg-config --libs --cflags libavcodec libavdevice libavfilter libavformat libavutil libswscale libswresample libpostproc (code 1)

Package libavcodec was not found in the pkg-config search path.
Perhaps you should add the directory containing `libavcodec.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libavcodec' found
Package libavdevice was not found in the pkg-config search path.
Perhaps you should add the directory containing `libavdevice.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libavdevice' found
Package libavfilter was not found in the pkg-config search path.
Perhaps you should add the directory containing `libavfilter.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libavfilter' found
Package libavformat was not found in the pkg-config search path.
Perhaps you should add the directory containing `libavformat.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libavformat' found
Package libavutil was not found in the pkg-config search path.
Perhaps you should add the directory containing `libavutil.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libavutil' found
Package libswscale was not found in the pkg-config search path.
Perhaps you should add the directory containing `libswscale.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libswscale' found
Package libswresample was not found in the pkg-config search path.
Perhaps you should add the directory containing `libswresample.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libswresample' found
Package libpostproc was not found in the pkg-config search path.
Perhaps you should add the directory containing `libpostproc.pc'
to the PKG_CONFIG_PATH environment variable
No package 'libpostproc' found


Selecting SDL2 out of (SDL, SDL2)
Generating ffconfig.h
Traceback (most recent call last):
  File "setup.py", line 220, in <module>
    with open(join('ffpyplayer', 'includes', 'ffconfig.h'), 'w') as f:
IOError: [Errno 2] No such file or directory: 'ffpyplayer/includes/ffconfig.h'

I am using Linux Mint 18.1 64bit

Build for iOS fail

Versions

  • Python: 3.7.1
  • OS: MacOS 10.13.6
  • Kivy: 1.10.1
  • FFPyplayer: 4.1.0
  • Kivi-iOS: master
  • Xcode: Version 10.1 (10B61)
  • Clang: Apple LLVM version 10.0.0 (clang-1000.11.45.5)

Description

I really don't know why clang can't find codecpar in AVStream. Do you know anything about this error?

tcode(emsg(ret, self.msg, sizeof(self.msg)))))
ret = avcodec_parameters_to_context(self.codec_ctx, self.format_ctx.streams[0].codecpar)
if ret < 0:
raise Exception("Failed to open input file {}: {}".format(filename,

Logs

[INFO    ] Running Shell: /Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/hostpython3/bin/python ('setup.py', 'build_ext', '-g') 
{'_env': {'HAS_SDL2': '1', 'LD': u'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld', 'USE_SDL2_MIXER': '1', 'LDFLAGS': u'-arch x86_64 --sysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk -L/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/lib -lsqlite3 -miphoneos-version-min=8.0', 'KIVYIOSROOT': '/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios', 'CC': '/var/folders/vx/ywrxzl3n27q09h2psqlq4xk80000gn/T/tmp4mhhEm -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64/libffi -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/common/sdl2_mixer', 'OTHER_CFLAGS': '-I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64/ffi -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64/openssl -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64/ffmpeg -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64', 'FFMPEG_LIB_DIR': u'/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/build/ffmpeg/x86_64/ffmpeg-2.6.3/dist/lib', 'ARM_LD': u'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld', 'OTHER_LDFLAGS': '-L/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/lib', 'FFMPEG_INCLUDE_DIR': '/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64/ffmpeg', 'CXX': '/var/folders/vx/ywrxzl3n27q09h2psqlq4xk80000gn/T/tmpGnZOOE', 'AR': u'/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar', 'SDL_INCLUDE_DIR': '/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/common/sdl2', 'CFLAGS': '-O3 -miphoneos-version-min=8.0 -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64/ffi -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64/openssl -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64/ffmpeg -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64 -Wno-implicit-function-declaration -fno-strict-aliasing', 'LDSHARED': '/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/tools/liblink', 'SDL_LIB_DIR': '/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/lib', 'ARCH': 'x86_64', 'IOSSDKROOT': u'/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator12.1.sdk'}, '_iter': True, '_out_bufsize': 1, '_err_to_out': True}
[DEBUG   ] Environ change has_sdl2 -> True
[DEBUG   ] Environ change use_sdl2_mixer -> True
[DEBUG   ] Generating ffconfig.h
[DEBUG   ] Generating ffconfig.pxi
[DEBUG   ] running build_ext
[DEBUG   ] building 'ffpyplayer.pic' extension
[DEBUG   ] /var/folders/vx/ywrxzl3n27q09h2psqlq4xk80000gn/T/tmp4mhhEm -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64/libffi -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/common/sdl2_mixer -DNDEBUG -g -fwrapv -O3 -Wall -O3 -miphoneos-version-min=8.0 -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64/ffi -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64/openssl -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64/ffmpeg -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64 -Wno-implicit-function-declaration -fno-strict-aliasing -g -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/common/sdl2 -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/include/x86_64/ffmpeg -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/build/ffpyplayer/x86_64/ffpyplayer-4.1.0/ffpyplayer -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/build/ffpyplayer/x86_64/ffpyplayer-4.1.0/ffpyplayer/includes -I/Users/ivc/kivy/.buildozer/ios/platform/kivy-ios/dist/hostpython3/include/python3.7m -c ffpyplayer/pic.c -o build/temp.macosx-10.13-x86_64-3.7/ffpyplayer/pic.o
[DEBUG   ] ffpyplayer/pic.c:10097:112: error: no member named 'codecpar' in
[DEBUG   ]       'struct AVStream'
[DEBUG   ]   ...(__pyx_v_self->format_ctx->streams[0])->codecpar);
[DEBUG   ]      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~  ^
[DEBUG   ] 1 error generated.
[DEBUG   ] error: command '/var/folders/vx/ywrxzl3n27q09h2psqlq4xk80000gn/T/tmp4mhhEm' failed with exit status 1

full-log.txt

undefined symbol

from ffpyplayer.player import MediaPlayer
File "/usr/local/lib/python2.7/dist-packages/ffpyplayer/player/init.py", line 10, in
from ffpyplayer.player.player import MediaPlayer
ImportError: /usr/local/lib/python2.7/dist-packages/ffpyplayer/player/player.so: undefined symbol: avcodec_dct_alloc

Running this from ffpyplayer (master), after installing FFMpeg (master) via this configuration:

sudo ./configure --enable-gpl --enable-nonfree --enable-mmal --enable-omx --enable-omx-rpi --enable-shared --extra-cflags="-fPIC"

Any ideas on how to resolve this issue? Thanks!

4.1.0 and master fails to install via pip

Tried using Cython 0.28.5 and 0.23.0, fails with the same error message. Also fails same way on master.

ffpyplayer 4.0.1 installs successfully.

System is Ubuntu 16.04, python 2.7

==============

~$ sudo -H pip install ffpyplayer==4.1.0
/usr/local/lib/python2.7/dist-packages/pip/_vendor/requests/init.py:83: RequestsDependencyWarning: Old version of cryptography ([1, 2, 3]) may cause slowdown.
warnings.warn(warning, RequestsDependencyWarning)
Collecting ffpyplayer==4.1.0
Using cached https://files.pythonhosted.org/packages/d6/72/827ee3a519128ba6ea6e6714789435eefbadc03eef92d642f858bd64a313/ffpyplayer-4.1.0.tar.gz
Building wheels for collected packages: ffpyplayer
Running setup.py bdist_wheel for ffpyplayer ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-install-wPy4ro/ffpyplayer/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" bdist_wheel -d /tmp/pip-wheel-Jt_Vz9 --python-tag cp27:
Selecting SDL2 out of (SDL, SDL2)
Generating ffconfig.h
Generating ffconfig.pxi
running bdist_wheel
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/ffpyplayer
copying ffpyplayer/init.py -> build/lib.linux-x86_64-2.7/ffpyplayer
creating build/lib.linux-x86_64-2.7/ffpyplayer/player
copying ffpyplayer/player/init.py -> build/lib.linux-x86_64-2.7/ffpyplayer/player
creating build/lib.linux-x86_64-2.7/ffpyplayer/tests
copying ffpyplayer/tests/common.py -> build/lib.linux-x86_64-2.7/ffpyplayer/tests
copying ffpyplayer/tests/init.py -> build/lib.linux-x86_64-2.7/ffpyplayer/tests
copying ffpyplayer/tests/test_play.py -> build/lib.linux-x86_64-2.7/ffpyplayer/tests
copying ffpyplayer/tests/test_write.py -> build/lib.linux-x86_64-2.7/ffpyplayer/tests
copying ffpyplayer/tests/test_pic.py -> build/lib.linux-x86_64-2.7/ffpyplayer/tests
creating build/lib.linux-x86_64-2.7/ffpyplayer/clib
copying ffpyplayer/clib/misc.h -> build/lib.linux-x86_64-2.7/ffpyplayer/clib
running build_ext
cythoning ffpyplayer/pic.pyx to ffpyplayer/pic.c

Error compiling Cython file:

...
>>> img2 = copy.deepcopy(img)
'''

all = ('Image', 'SWScale', 'get_image_size', 'ImageLoader')

include "includes/inline_funcs.pxi"
^

ffpyplayer/pic.pyx:57:0: 'includes/inline_funcs.pxi' not found

building 'ffpyplayer.pic' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/ffpyplayer
creating build/temp.linux-x86_64-2.7/ffpyplayer/clib
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/x86_64-linux-gnu -I/usr/include/SDL2 -I/tmp/pip-install-wPy4ro/ffpyplayer/ffpyplayer -I/tmp/pip-install-wPy4ro/ffpyplayer/ffpyplayer/includes -I/usr/include/python2.7 -c ffpyplayer/pic.c -o build/temp.linux-x86_64-2.7/ffpyplayer/pic.o -O3 -fno-strict-aliasing -Wno-error
ffpyplayer/pic.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
#error Do not use this file, it is the result of a failed Cython compilation.
^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1


Failed building wheel for ffpyplayer
Running setup.py clean for ffpyplayer
Failed to build ffpyplayer
Installing collected packages: ffpyplayer
Found existing installation: ffpyplayer 4.0.1
Uninstalling ffpyplayer-4.0.1:
Successfully uninstalled ffpyplayer-4.0.1
Running setup.py install for ffpyplayer ... error
Complete output from command /usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-install-wPy4ro/ffpyplayer/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-tTvOhj/install-record.txt --single-version-externally-managed --compile:
Selecting SDL2 out of (SDL, SDL2)
Generating ffconfig.h
Generating ffconfig.pxi
running install
running build
running build_py
creating build
creating build/lib.linux-x86_64-2.7
creating build/lib.linux-x86_64-2.7/ffpyplayer
copying ffpyplayer/init.py -> build/lib.linux-x86_64-2.7/ffpyplayer
creating build/lib.linux-x86_64-2.7/ffpyplayer/player
copying ffpyplayer/player/init.py -> build/lib.linux-x86_64-2.7/ffpyplayer/player
creating build/lib.linux-x86_64-2.7/ffpyplayer/tests
copying ffpyplayer/tests/common.py -> build/lib.linux-x86_64-2.7/ffpyplayer/tests
copying ffpyplayer/tests/init.py -> build/lib.linux-x86_64-2.7/ffpyplayer/tests
copying ffpyplayer/tests/test_play.py -> build/lib.linux-x86_64-2.7/ffpyplayer/tests
copying ffpyplayer/tests/test_write.py -> build/lib.linux-x86_64-2.7/ffpyplayer/tests
copying ffpyplayer/tests/test_pic.py -> build/lib.linux-x86_64-2.7/ffpyplayer/tests
creating build/lib.linux-x86_64-2.7/ffpyplayer/clib
copying ffpyplayer/clib/misc.h -> build/lib.linux-x86_64-2.7/ffpyplayer/clib
running build_ext
cythoning ffpyplayer/pic.pyx to ffpyplayer/pic.c

Error compiling Cython file:
------------------------------------------------------------
...
    >>> img2 = copy.deepcopy(img)
'''

__all__ = ('Image', 'SWScale', 'get_image_size', 'ImageLoader')

include "includes/inline_funcs.pxi"
^
------------------------------------------------------------

ffpyplayer/pic.pyx:57:0: 'includes/inline_funcs.pxi' not found

building 'ffpyplayer.pic' extension
creating build/temp.linux-x86_64-2.7
creating build/temp.linux-x86_64-2.7/ffpyplayer
creating build/temp.linux-x86_64-2.7/ffpyplayer/clib
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -Wdate-time -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -I/usr/include/x86_64-linux-gnu -I/usr/include/SDL2 -I/tmp/pip-install-wPy4ro/ffpyplayer/ffpyplayer -I/tmp/pip-install-wPy4ro/ffpyplayer/ffpyplayer/includes -I/usr/include/python2.7 -c ffpyplayer/pic.c -o build/temp.linux-x86_64-2.7/ffpyplayer/pic.o -O3 -fno-strict-aliasing -Wno-error
ffpyplayer/pic.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
 #error Do not use this file, it is the result of a failed Cython compilation.
  ^
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1

----------------------------------------

Rolling back uninstall of ffpyplayer
Command "/usr/bin/python -u -c "import setuptools, tokenize;file='/tmp/pip-install-wPy4ro/ffpyplayer/setup.py';f=getattr(tokenize, 'open', open)(file);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, file, 'exec'))" install --record /tmp/pip-record-tTvOhj/install-record.txt --single-version-externally-managed --compile" failed with error code 1 in /tmp/pip-install-wPy4ro/ffpyplayer/
brent@brent-desktop:~$

About player.get_frame()

The return object is: ffpyplayer.pic.Image
hwo to convert it to opencv mat or numpy ?
I want used opencv3 cv2.imshow("", mat) method to draw.

size = img.get_size()
imgBuffer = img.to_bytearray()[0]
w, h = size[0], size[1]
nparrary1 = np.array(imgBuffer)
nparrary2 = nparrary1.reshape((h, w, 3))
cv2.cvtColor(nparrary2, cv2.COLOR_BGR2RGB, nparrary2)
cv2.imshow("Title", nparrary2)

No way to specify video decoder via kivy video source provider settings

Related issue: kivy/kivy#6171

We're using ffpyplayer in kivy, and it seems to be selecting the default software h264 decoder in the kivy video provider, even though we compiled ffmpeg with the specific hardware decoder.

What would be the best way to pass the preferred vcodec parameter when we set the KIVY_VIDEO environment variable in our app ?

Perhaps an additional environment variable "FFPYPLAYER_VCODEC" ?

Markdown syntax at installation documentation page

Little styling issue in: we need the shared version. This means that --enable-shared and --extra-cflags="-fPIC"`need to be added when compiling FFmpeg AND its dependencies. And if present,``--disable-shared or --enable-static must be removed.

Not able to retrieve an Audio object after Player is created

Hello,

I've been using this module quite a bit and it has been very useful so far.
I am having difficulties though when it comes to work on the Audio.

More specifically, I am trying to get the audio from an RTP stream in order to detect any silences.
What would be the best method to get an Audio Object once the Mediaplayer instance created ?

Thank you so much !

oDev

Support ffmpeg's per-file options

Hi,

I've been experimenting with your library (very nice work by the way) and I'm wondering if there's a special syntax that I need to use with lib_opts to support ffmpeg's per-file options. Specifically, I'm trying to use the qscale flag, which as I understand is the 'preferred' way of setting the output video quality:

-q q                use fixed quality scale (VBR)
-qscale q           use fixed quality scale (VBR)

From the docs, lib_opts is meant to receive flags that the encoder supports, and it looks qscale isn't one of them for the codec I was experimenting with (msmpeg4v2). I was eventually able to find this page, which made me try lib_opts={'flags':'qscale'} which for my case worked - the output video has visibly higher quality, even if I couldn't set the specific number to qscale.

My question is, is there a way to pass these "general" per-file options that ffmpeg (the binary) supports? If the answer is "no", is there an interest in such functionality?

Thank you for your time.

Rasbian and ffpyplayer

Hi!

Is this supposed to be usable on a Raspberry Pi 3 running raspbian ?

I managed to install it (took me some time), but when I try to use it with Kivy I get something like this:

[INFO   ] [Logger      ] Record log in /home/hatsune/.kivy/logs/kivy_18-01-05_48.txt
[INFO   ] [Kivy        ] v1.10.1.dev0, git-59888a2, 20180104
[INFO   ] [Python      ] v2.7.13 (default, Nov 24 2017, 17:33:09)
[GCC 6.3.0 20170516]
[INFO   ] [Factory     ] 194 symbols loaded
[INFO   ] [ImageLoaderFFPy] Using ffpyplayer 4.1.0.dev0
[INFO   ] [Image       ] Providers: img_tex, img_dds, img_sdl2, img_pil, img_ffpyplayer, img_gif
[INFO   ] [Text        ] Provider: sdl2
[INFO   ] [VideoFFPy   ] Using ffpyplayer 4.1.0.dev0
[INFO   ] [Video       ] Provider: ffpyplayer(['video_gstplayer', 'video_ffmpeg'] ignored)
[INFO   ] [Window      ] Provider: egl_rpi
[INFO   ] [GL          ] Using the "OpenGL ES 2" graphics system
[INFO   ] [GL          ] Backend used <gl>
[INFO   ] [GL          ] OpenGL version <OpenGL ES 2.0>
[INFO   ] [GL          ] OpenGL vendor <Broadcom>
[INFO   ] [GL          ] OpenGL renderer <VideoCore IV HW>
[INFO   ] [GL          ] OpenGL parsed version: 2, 0
[INFO   ] [GL          ] Shading version <OpenGL ES GLSL ES 1.00>
[INFO   ] [GL          ] Texture max size <2048>
[INFO   ] [GL          ] Texture max units <8>
[INFO   ] [Window      ] virtual keyboard not allowed, single mode, not docked
[INFO   ] [GL          ] NPOT texture support is available
[ERROR  ] Unknown <mp4> type, no loader found.
[ERROR  ] [Image       ] Error loading texture video.mp4
[INFO   ] [OSC         ] using <multiprocessing> for socket
[INFO   ] [Base        ] Start application main loop
/full/path/to/video: Invalid data found when processing input

Thanks in advance

Memory from copied images not freed

I was (erroneously) using memoryview instead of to_bytearray to pass data to a cairo ImageSurface object and had to do a deepcopy on the image each frame, otherwise the original buffer contents would change by the time it got rendered.

Doing copy.deepcopy(img) around 30 times per second caused a massive memory leak, even if no references to the image were kept.

Have I missed something, does the image object need to be released manually? I've tried deleting immediatelly after a copy, no effect.

Using python3 and ffyplayer 4.1.0 @d1b43f6

Audio broken on Ubuntu 18.04 LTS (installed via wheel)

Hi,

In a virtualenv with Python 3.7.3. I've followed the instructions for installing on Linux (i.e. https://kivy.org/doc/stable/installation/installation-linux.html#using-precompiled-wheels). I've checked the ffplay command works with the specific file (it does).

When I try to play audio I see the following in the logs:

[WARNING] [ffpyplayer  ] SDL_OpenAudio (2 channels, 44100 Hz): No such audio device
[WARNING] [ffpyplayer  ] SDL_OpenAudio (1 channels, 44100 Hz): No such audio device
[ERROR  ] [ffpyplayer  ] No more channel combinations to try, audio open failed
[CRITICAL] [ffpyplayer  ] Failed to open file '/home/ntoll/src/pyoa/meow1.wav' or configure filtergraph

Any idea what's going on..?

Thanks!

Error installing ffpyplayer on Fedora 24

I have tried to install ffpyplayer in two ways and they both fail. I am attempting to install on Fedora 24.

pip install ffpyplayer
pip install https://github.com/matham/ffpyplayer/archive/master.zip

The first fails thus:
Collecting ffpyplayer
Using cached ffpyplayer-4.0.0.zip
Complete output from command python setup.py egg_info:
Selecting SDL2 out of (SDL, SDL2)
Generating ffconfig.h
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-hYVJHt/ffpyplayer/setup.py", line 220, in
with open(join('ffpyplayer', 'includes', 'ffconfig.h'), 'w') as f:
IOError: [Errno 2] No such file or directory: 'ffpyplayer/includes/ffconfig.h'

The second failure is included in the attached errorout file.
errorout.txt

I have the following on my machine:
SDL2_ttf-2.0.14-1.fc24.x86_64
SDL2-devel-2.0.4-8.fc24.x86_64
SDL2_image-devel-2.0.1-2.fc24.x86_64
SDL2_mixer-devel-2.0.1-2.fc24.x86_64
SDL2_image-2.0.1-2.fc24.x86_64
SDL2-2.0.4-8.fc24.x86_64
SDL2_ttf-devel-2.0.14-1.fc24.x86_64
SDL2_mixer-2.0.1-2.fc24.x86_64

There are a number of files in /usr/lib64/pkgconfig that belong to the ffmpeg-devel package:

rpm -ql ffmpeg-devel-3.0.3-2.fc24.x86_64 | grep pkgconfig

/usr/lib64/pkgconfig/libavcodec.pc
/usr/lib64/pkgconfig/libavdevice.pc
/usr/lib64/pkgconfig/libavfilter.pc
/usr/lib64/pkgconfig/libavformat.pc
/usr/lib64/pkgconfig/libavresample.pc
/usr/lib64/pkgconfig/libavutil.pc
/usr/lib64/pkgconfig/libpostproc.pc
/usr/lib64/pkgconfig/libswresample.pc
/usr/lib64/pkgconfig/libswscale.pc

Thanks.

play loop never stop

the while loop never stops, what should I do if just need to play the audio once ?

import time
filename = 'cox.spx
from ffpyplayer.player import MediaPlayer
player = MediaPlayer(filename)

i = 0
while 1:
    i += 1
    print(i)
    frame, val = player.get_frame()
    print('get_frame-----------', frame, val)
    if val == 'eof':
        break
    elif frame is None:
        time.sleep(0.01)
    else:
        img, t = frame
        print(val, t, img.get_pixel_format(), img.get_buffer_size())
        time.sleep(val)

Cant install from pip

OS: Ubuntu 18.04
Python: 3.6
Cython: 0.29.6

v@ubuntu:~/PycharmProjects/testapp$ pip install ffpyplayer
Collecting ffpyplayer
  Using cached https://files.pythonhosted.org/packages/d6/72/827ee3a519128ba6ea6e6714789435eefbadc03eef92d642f858bd64a313/ffpyplayer-4.1.0.tar.gz
Installing collected packages: ffpyplayer
  Running setup.py install for ffpyplayer ... error
    Complete output from command /home/v/PycharmProjects/testapp/venv2/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-u0wyz3ee/ffpyplayer/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-vvvopiph/install-record.txt --single-version-externally-managed --compile --install-headers /home/v/PycharmProjects/testapp/venv2/include/site/python3.6/ffpyplayer:
    WARNING: A problem occured while running pkg-config --libs --cflags libavcodec libavdevice libavfilter libavformat libavutil libswscale libswresample libpostproc (code 1)
    
    b"Package libavdevice was not found in the pkg-config search path.\nPerhaps you should add the directory containing `libavdevice.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'libavdevice' found\nPackage libavfilter was not found in the pkg-config search path.\nPerhaps you should add the directory containing `libavfilter.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'libavfilter' found\nPackage libpostproc was not found in the pkg-config search path.\nPerhaps you should add the directory containing `libpostproc.pc'\nto the PKG_CONFIG_PATH environment variable\nNo package 'libpostproc' found\n"
    
    Selecting SDL2 out of (SDL, SDL2)
    Generating ffconfig.h
    Generating ffconfig.pxi
    running install
    running build
    running build_py
    creating build
    creating build/lib.linux-x86_64-3.6
    creating build/lib.linux-x86_64-3.6/ffpyplayer
    copying ffpyplayer/__init__.py -> build/lib.linux-x86_64-3.6/ffpyplayer
    creating build/lib.linux-x86_64-3.6/ffpyplayer/player
    copying ffpyplayer/player/__init__.py -> build/lib.linux-x86_64-3.6/ffpyplayer/player
    creating build/lib.linux-x86_64-3.6/ffpyplayer/tests
    copying ffpyplayer/tests/test_play.py -> build/lib.linux-x86_64-3.6/ffpyplayer/tests
    copying ffpyplayer/tests/test_pic.py -> build/lib.linux-x86_64-3.6/ffpyplayer/tests
    copying ffpyplayer/tests/common.py -> build/lib.linux-x86_64-3.6/ffpyplayer/tests
    copying ffpyplayer/tests/__init__.py -> build/lib.linux-x86_64-3.6/ffpyplayer/tests
    copying ffpyplayer/tests/test_write.py -> build/lib.linux-x86_64-3.6/ffpyplayer/tests
    creating build/lib.linux-x86_64-3.6/ffpyplayer/clib
    copying ffpyplayer/clib/misc.h -> build/lib.linux-x86_64-3.6/ffpyplayer/clib
    running build_ext
    cythoning ffpyplayer/pic.pyx to ffpyplayer/pic.c
    
    Error compiling Cython file:
    ------------------------------------------------------------
    ...
        >>> img2 = copy.deepcopy(img)
    '''
    
    __all__ = ('Image', 'SWScale', 'get_image_size', 'ImageLoader')
    
    include "includes/inline_funcs.pxi"
    ^
    ------------------------------------------------------------
    
    ffpyplayer/pic.pyx:57:0: 'includes/inline_funcs.pxi' not found
    
    building 'ffpyplayer.pic' extension
    creating build/temp.linux-x86_64-3.6
    creating build/temp.linux-x86_64-3.6/ffpyplayer
    creating build/temp.linux-x86_64-3.6/ffpyplayer/clib
    x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -g -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -I/usr/include/SDL2 -I/tmp/pip-install-u0wyz3ee/ffpyplayer/ffpyplayer -I/tmp/pip-install-u0wyz3ee/ffpyplayer/ffpyplayer/includes -I/home/v/PycharmProjects/testapp/venv2/include -I/usr/include/python3.6m -c ffpyplayer/pic.c -o build/temp.linux-x86_64-3.6/ffpyplayer/pic.o -O3 -fno-strict-aliasing -Wno-error
    ffpyplayer/pic.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
     #error Do not use this file, it is the result of a failed Cython compilation.
      ^~~~~
    error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
    
    ----------------------------------------
Command "/home/v/PycharmProjects/testapp/venv2/bin/python -u -c "import setuptools, tokenize;__file__='/tmp/pip-install-u0wyz3ee/ffpyplayer/setup.py';f=getattr(tokenize, 'open', open)(__file__);code=f.read().replace('\r\n', '\n');f.close();exec(compile(code, __file__, 'exec'))" install --record /tmp/pip-record-vvvopiph/install-record.txt --single-version-externally-managed --compile --install-headers /home/v/PycharmProjects/testapp/venv2/include/site/python3.6/ffpyplayer" failed with error code 1 in /tmp/pip-install-u0wyz3ee/ffpyplayer/

duplicate symbols (kivy-ios)

I am trying to update the kivy-ios recipe to v4.0.0. I am not sure what to do about this error.

duplicate symbol _get_plane_sizes in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(threading.so.o)
duplicate symbol _opt_default in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(threading.so.o)
duplicate symbol _opt_find in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(threading.so.o)
duplicate symbol _print_all_libs_info in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(threading.so.o)
duplicate symbol _get_plane_sizes in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(tools.so.o)
duplicate symbol _opt_default in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(tools.so.o)
duplicate symbol _opt_find in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(tools.so.o)
duplicate symbol _print_all_libs_info in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(tools.so.o)
duplicate symbol _get_plane_sizes in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(writer.so.o)
duplicate symbol _opt_default in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(writer.so.o)
duplicate symbol _opt_find in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(writer.so.o)
duplicate symbol _print_all_libs_info in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(writer.so.o)
duplicate symbol _get_plane_sizes in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(clock.so.o)
duplicate symbol _opt_default in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(clock.so.o)
duplicate symbol _opt_find in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(clock.so.o)
duplicate symbol _print_all_libs_info in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(clock.so.o)
duplicate symbol _get_plane_sizes in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(core.so.o)
duplicate symbol _opt_default in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(core.so.o)
duplicate symbol _opt_find in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(core.so.o)
duplicate symbol _print_all_libs_info in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(core.so.o)
duplicate symbol _get_plane_sizes in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(decoder.so.o)
duplicate symbol _opt_default in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(decoder.so.o)
duplicate symbol _opt_find in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(decoder.so.o)
duplicate symbol _print_all_libs_info in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(decoder.so.o)
duplicate symbol _get_plane_sizes in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(frame_queue.so.o)
duplicate symbol _opt_default in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(frame_queue.so.o)
duplicate symbol _opt_find in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(frame_queue.so.o)
duplicate symbol _print_all_libs_info in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(frame_queue.so.o)
duplicate symbol _get_plane_sizes in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(player.so.o)
duplicate symbol _opt_default in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(player.so.o)
duplicate symbol _opt_find in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(player.so.o)
duplicate symbol _print_all_libs_info in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(player.so.o)
duplicate symbol _get_plane_sizes in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(queue.so.o)
duplicate symbol _opt_default in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(queue.so.o)
duplicate symbol _opt_find in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(queue.so.o)
duplicate symbol _print_all_libs_info in:
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(pic.so.o)
    /Users/kamerawerk/Projects/pool/.buildozer/ios/platform/kivy-ios/dist/lib/libffpyplayer.a(queue.so.o)
ld: 36 duplicate symbols for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Cython compilation failure error

I am trying to install ffpyplayer in Ubuntu Mate running under Virtualbox on Windows7 after installing buildozer in a virtual environment (per these instructions). The log at the link below shows a problem with setuptools but we confirmed it was installed correctly, we believe (@kuzeyron is the other half of 'we'). I also installed cython==0.29.9 per online docs and got same results. Not sure what I need to do to get around this cython compilation error.

https://gist.github.com/frankgould/bffcad93c6f2b29255aec8601ba2ecb0

«'VideoFFPy' object has no attribute '_fbo'» while using with Kivy

I used same code, config and video as at this page. ffpyplayer was installed instead of kivy.deps.gstreamer.

Exception I got:

   File "C:\Users\gmn\Dropbox\gmn\code\.virtualenvs\LLP_3.4\lib\site-packages\kivy\core\video\video_ffpyplayer.py", line 205, in _redraw
     self._fbo.ask_update()
 AttributeError: 'VideoFFPy' object has no attribute '_fbo'

This is from Kivy log:

[INFO              ] [VideoFFPy   ] Using ffpyplayer 4.0.0
[INFO              ] [Video       ] Provider: ffpyplayer(['video_ffmpeg'] ignored)

Can't play audio stream on Android

Hi Matham, I hope you're doing good :-)

I'm trying to play my webradio https://tms-server.com/radio.ogg on Android, which freezes my application for a good while, and then I get this:

I/AEE/AED (15507): *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
I/AEE/AED (15507): Build fingerprint: 'alps/full_n316b/n316b:5.1/LMY47D/1446172618:user/test-keys'
I/AEE/AED (15507): Revision: '0'
I/AEE/AED (15507): ABI: 'arm'
I/AEE/AED (15507): pid: 15353, tid: 15386, name: SDLThread  >>> org.cheaterman.tmsapp <<<
I/AEE/AED (15507): signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x10
I/AEE/AED (15507):     r0 00000000  r1 00000000  r2 00000001  r3 a2691018
I/AEE/AED (15507):     r4 00000080  r5 9fdbf318  r6 9fb65e40  r7 a2d9ddf8
I/AEE/AED (15507):     r8 a07404a4  r9 00000008  sl 00000000  fp a2d9de40
I/AEE/AED (15507):     ip a073be18  sp a2d9dde8  lr a07277db  pc a3fe689c  cpsr 200f0030
I/AEE/AED (15507): 
I/AEE/AED (15507): backtrace:
I/AEE/AED (15507):     #00 pc 0000889c  /data/app/org.cheaterman.tmsapp-1/lib/arm/libSDL2_mixer.so (Mix_Volume+39)
I/AEE/AED (15507):     #01 pc 000097d7  /data/data/org.cheaterman.tmsapp/files/app/_python_bundle/site-packages/ffpyplayer/player/player.so

Thanks in advance if you have ideas - I'll try to poke at it myself too.

Build broken with -Werror

python setup.py build_ext --inplace -f
Selecting SDL2 out of (SDL, SDL2)
Generating ffconfig.h
Generating ffconfig.pxi
running build_ext
cythoning ffpyplayer/player.pyx to ffpyplayer/player.c
building 'ffpyplayer.player' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -D_FORTIFY_SOURCE=2 -g -fstack-protector-strong -Wformat -Werror=format-security -fPIC -Isdl/include/SDL2 -Iffmpeg/include -I/usr/include/python2.7 -c ffpyplayer/player.c -o build/temp.linux-x86_64-2.7/ffpyplayer/player.o -O3 -fno-strict-aliasing
ffpyplayer/player.c: In function ‘__pyx_f_10ffpyplayer_6player_11MediaPlayer_close_player’:
ffpyplayer/player.c:5155:5: error: format not a string literal and no format arguments [-Werror=format-security]
     printf(__pyx_k__16);
     ^
In file included from ffpyplayer/player.c:270:0:
ffpyplayer/player.c: At top level:
ffpyplayer/ffinfo.h:51:13: warning: ‘print_all_libs_info’ defined but not used [-Wunused-function]
 static void print_all_libs_info(int flags, int level)
             ^
ffpyplayer/ffinfo.h:161:12: warning: ‘get_plane_sizes’ defined but not used [-Wunused-function]
 static int get_plane_sizes(int size[4], int required_plane[4], enum AVPixelFormat pix_fmt,
            ^
cc1: some warnings being treated as errors
error: command 'x86_64-linux-gnu-gcc' failed with exit status 1
Makefile:9: recipe for target 'force' failed

Raw data decoding?

Hi,

I have been asking a similar question on other repositories lately and that is if there is a way I could decode raw FLV1 (H.263) video data (from an RTMP source), and decode it into an AVFrame (by maybe providing a AVPacket) and then get the PIL image?

This is something I was looking for on the PyAV repository but that is currently just tailored to handle individual files. I am not sure if this repository is the same.

Thank you.

Build issue on OSX

 Traceback (most recent call last):
   File "test.py", line 9, in <module>
     from ffpyplayer.player import MediaPlayer
   File "ffpyplayer/player.pyx", line 31, in init ffpyplayer.player (ffpyplayer/player.c:8146)
     from ffpyplayer.tools import loglevels, _initialize_ffmpeg
 ImportError: dlopen(/Users/ben/Projects/ffpyplayer/ffpyplayer/tools.so, 2): Symbol not found: _AVMediaTypeAudio
   Referenced from: /Users/ben/Projects/ffpyplayer/ffpyplayer/tools.so
   Expected in: flat namespace
  in /Users/ben/Projects/ffpyplayer/ffpyplayer/tools.so

This might not be a bug but rather me doing something wrong. The compete build and run log can be found here: http://pastebin.com/kX7rm49S

No such file or directory: 'ffpyplayer/includes/ffconfig.h'

When i run the command "pip install ffpyplayer" on OSX i receive the following error. I'm not sure if it's OS related.
Python: 2.7
Cython: 0.23

There is a similar issue #23 but it didn't helped me...

I hope somebody knows a solution?

Collecting ffpyplayer
Using cached ffpyplayer-4.0.0.zip
Complete output from command python setup.py egg_info:
Selecting SDL2 out of (SDL, SDL2)
Generating ffconfig.h
Traceback (most recent call last):
File "", line 1, in
File "/private/var/folders/z7/kz40w76s6fncq63_bbx0mcvc0000gn/T/pip-build-E7ukWu/ffpyplayer/setup.py", line 220, in
with open(join('ffpyplayer', 'includes', 'ffconfig.h'), 'w') as f:
IOError: [Errno 2] No such file or directory: 'ffpyplayer/includes/ffconfig.h'

Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/z7/kz40w76s6fncq63_bbx0mcvc0000gn/T/pip-build-E7ukWu/ffpyplayer/

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.