PC/ffmpeg2022. 6. 14. 10:00

FFPLAY is the most powerful video player.
Video Player <--> libffplay.dll (ffplay) <--> ffmpeg dlls, SDL2.dll


A. Make a build environment

 1. Install MinGW (C:/MinGW)

     - Download https://sourceforge.net/projects/mingw/files/Installer/
     - Run mingw-get-setup.exe

  2. Install MinGW64 (C:/MinGW/mingw-w64/i686-8.1.0-win32-dwarf-rt_v6-rev0)

     - Download https://sourceforge.net/projects/mingw-w64/
     - Run mingw-w64-install.exe

  3. Copy utilities

     * nasm - 32bit
       - Download http://www.nasm.us/pub/nasm/releasebuilds/
       - Copy "nasm.exe" and "ndisasm.exe" to "msys/1.0/bin"

     * yasm - 64bit (for 64bit Windows 7)
       - Download http://yasm.tortall.net/Download.html
       - Copy "yasm-1.3.0-win64.exe" to "msys/1.0/bin" and rename "yasm.exe"

  4. Path setting (Environment Variables -> System Variables -> Path)

     - C:/MinGW/bin
     - C:/MinGW/msys/1.0/bin
     - C:/MinGW/mingw-w64/i686-8.1.0-win32-dwarf-rt_v6-rev0/mingw32/bin

  5. Run msys.bat

     - Run C:/MinGW/msys/1.0/msys.bat
       # Run as administrator

  6. SDL2 install

     - https://www.libsdl.org/download-2.0.php
     - Download SDL2-devel-2.0.10-mingw.tar.gz or latest version
     - Copy to "C:/MinGW/msys/1.0/local/"
     - Modify sld2-config file

  7. Build FFMPEG

     - https://ffmpeg.org/download.html
     - Download ffmpeg-4.2.tar.xz or latest version
     - Copy FFMPEG source to "C:/MinGW/msys/1.0/home/user_folder/"
     - Build

       ./configure --arch=x86 --target-os=mingw32
                       --enable-shared --enable-static
                       --extra-cflags="-I/local/include"
                       --extra-ldflags="-L/local/lib -static-libgcc"
                       --disable-debug

       make

       make install

B. Create libffplay.dll

  1. Create ffmpeg-4.2-ffplay folder

  2. Copy compat, libavformat, libavresample, libavutil and libpostproc folder

  3. Copy config.h from "home/usr_folder/ffmpeg-4.2/" folder

  4. Copy cmdutils.c, cmdutils.h and ffplay.c from "ffmpeg-4.2/fftools/"

  5. Create "libffplay.h"

  6. Rename "ffplay.c" to "libffplay.c" and modify it 

  * Manual build (libffplay.dll)

      gcc -I. -I/usr/local/include -O3 -c -o cmdutils.o cmdutils.c

      gcc -I. -I/usr/local/include -I/usr/local/include/SDL2 -Dmain=SDL_main
            -c -o libffplay.o libffplay.c

      gcc -shared -o libffplay.dll libffplay.o cmdutils.o -lavcodec -lavdevice -lavfilter -lavformat
            -lavutil -lswresample -lswscale -L/usr/local/lib -lmingw32 -lSDL2main -lSDL2 -lole32

           * -lole32 : undefined reference to '__imp_CoInitialize@4' error prevention. 

      strip libffplay.dll

  * Batch build (libffplay.dll)

      - Create "makefile" file

      make

C. Test

  Run EMPlayer.exe
  (You need libffplay.dll, SDL2.dll and ffmpeg-dlls to run EMPlayer)

D. Download

  ** Download full source and executable

  - Install (ffmpeg and sdl2 are not included)

Install.zip
2.43MB


  - Project (ver 0.1 - 1.2) : libffplay and test application full source

Project.zip
13.50MB


E. Reference

* Links
  http://forum.lazarus-ide.org/index.php/topic,40446.0.html
  
https://github.com/YepSfx/FFPlay-1.2.12

Posted by EMInfoTech