Building FFplay for Windows

来源:互联网 发布:jquery 1.12.4.min.js 编辑:程序博客网 时间:2024/05/26 17:44

 转载地址:http://www.wu.ece.ufl.edu/projects/wirelessVideo/project/realTimeCoding/buildingffplayforwindows.htm



Using MinGW and MSYS 


Introduction 

FFplayis a simple and portable media player using the FFmpeg and SDLlibraries. We modifies it and uses it as the video decoder of ourwireless video transmission testbed. 

FFplay is developedunder Linux but it is possible to build for Windows. This documentpresents the tools and procedures for cross compiling FFplay underWindows. It is based on the online tutorial “Building ffmpeg forWindows with MSYS and MinGW” with our own updates. The originaltutorial can be found from:
    http://www.gooli.org/blog/building-ffmpeg-for-windows-with-msys-and-mingw/ 

 

Tools 

We use MinGW and MSYS as the cross compiling platform. In this section, we list all the tools and software we will use. 

MinGW and MSYS
MinGWstands for Minimalist GNU for Windows. It is a native Windows port ofthe GNU Compiler Collection (GCC), with freely distributable importlibraries and header files for building native Windowsapplications. 

MSYS is a Minimal SYStem providing a POSIXcompatible Bourne shell environment, with a small collection of UNIXcommand line tools. It is primarily developed as a means to execute theconfigure scripts and Makefiles used to build Open Source software.MinGW and MSYS can be downloaded from:
    http://sourceforge.net/project/showfiles.php?group_id=2435

SDL Runtime Library
SDLstands for Simple DirectMedia Layer. It is a cross-platform multimedialibrary designed to provide low level access to audio, keyboard, mouse,joystick, 3D hardware via OpenGL, and 2D video framebuffer. FFplayrequires SDL library and here we need the Win32 runtime library“SDL.dll”. The library can be found from:
    http://www.libsdl.org/download-1.2.php

FFmpeg
Download our video encoding/decoding software based on FFmpeg. 

 

Updates 

Beforestart building, we need some updates for MinGW and MSYS. These updatesresolve bugs and compatibility issues in older versions. Below is thelist of necessary updates.

coreutils
Download coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2 from following address:
    http://downloads.sourceforge.net/mingw/coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2

w32api
Get MinGW API for MS-Windows w32api-3.13 from following address:
    http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=11550
Download w32api-3.13-mingw32-dev.tar.gz which has been compiled for i386. 

make
Get make-3.81 (or newer version) from:
    http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=24963
Download make-3.81-MSYS-1.0.11-2.tar.bz2 which has been compiled for i386.

bash
SinceFFplay’s configure script doesn’t work with bash 2.0.4 that comes withMSYS. We need bash with a newer version. bash-3.1-MSYS-1.0.11-1.tar.bz2can be downloaded from:
    http://sourceforge.net/project/showfiles.php?group_id=2435&package_id=24963

SDL Development Library
To cross compile FFplay, we need SDL development library to be installed. The library can obtained from:
    http://www.libsdl.org/download-1.2.php
Download the SDL source codes SDL-1.2.13.tar.gz. 

 

Install and Build 

Now we are ready to install the tools and updates.
1. Install MinGW (choose “MinGW base tools” and “MinGW make”) into c:\mingw
2. Install MSYS into c:\msys\1.0
3.After MSYS installation, it will run a post install script. It will askyou some questions which you should answer as following:
    • Do you wish to continue with the post install? [yn ] —> y
    • Do you have MinGW installed? [yn ] —> y
    • Where is your MinGW installation? —> C:/mingw
4. Extract coreutils-5.97-MSYS-1.0.11-snapshot.tar.bz2. This file contains four directories:bin, info, lib, and man. Copy all files within these four directories to corresponding directories under C:\MinGW to overwrite old files.
5. Extract w32api-3.13-mingw32-dev.tar.gz. This file contains two directories: include and lib. Copy all files within these two directories to corresponding directories under C:\MinGW to overwrite old files.
6. Extract make-3.81-MSYS-1.0.11-2.tar.bz2. This file contains three directories:bin and share. Copy all files within these two directories to corresponding directories under C:\MinGW
to overwrite old files. And copy “make.exe” to C:\msys\1.0\bin.
7. Extract bash-3.1-MSYS-1.0.11-1.tar.bz2. It contains three directories: bin, info,and man.Copy all files within these three directories to correspondingdirectories under C:\MinGW to overwrite old files. And copy “bash.exe”to C:\msys\1.0\bin.
8. Extract SDL-1.2.13.tar.gz. Under MSYS shell, go to directory SDL-1.2.13 and run following commands to install SDL:
    • ./configure
    • make
    • make install
9. FFmpeg (our trimmed version, download here)
    • Create a file called “myconfig” in C:\work\ffmpeg and copy the following into it:
         #!/bin/sh
         ./configure --extra-cflags="-mno-cygwin -mms-bitfields"
         --extra-ldflags="-Wl,-add-stdcall-alias" --enable-memalign-hack
         --target-os=mingw32 --disable-shared --enable-static --disable-mmx
         --disable-mmx2 --disable-ffmpeg
         --enable-swscale --enable-gpl
    • Under MSYS shell, go to directory c/work/ffmpeg and run following commands to build FFplay:
        • ./myconfigure
        • make

Beforerunning make, read the configuration output and make sure that the SDLcheck is “yes”. This means you have correctly installed SDL libraries.Otherwise FFplay won’t be built. If everything goes right, now youshould be able to get ffplay.exe that runs under Windows.

 

To Use FFplay 

Torun FFplay, collect ffplay.exe and SDL.dll and put them in onedirectory. Now you are ready to go! You will be able to play localH.264 bitstreams, as well as receiving UDP packets. Below we listfrequently used options and hot keys of ffplay.

Options: 

  • -h: show help
  • -f: force format
  • -s: set frame size (WxH or abbreviation)
  • -dest_port: specify destination port number
  • -fs: force full screen
  • -x: force displayed width
  • -y: force displayed height

Hot keys:

  • q/ESC: quit
  • f: toggle full screen
  • p/SPC: pause 

Play Local File
OpenWindows cmd.exe and go to the directory that contains ffplay.exe andSDL.dll. Assume that you have a H.264 bitstream called foreman cif.264in the same directory. Run following command to play the H.264 file:
    ffplay.exe foreman_qcif.264
Whileplaying you can press “f” to toggle full screen display. Press “q” or“ESC” to quit ffplay. You can also specify the display window sizethrough command line options. The figure below shows the screen shot offfplay under Windows XP.

 

Receive Packets Using Socket
Toreceive UDP packets, you need specify the socket port through commandline option. Assume port number 12345 is used, use following command:
    ffplay.exe -dest_port 12345 -f h264
Withthe knowledge of your IP address and port number, the transmitter canthen send encoded H.264 packets to you. ffplay will be able to pick upand decode the packets, and to display video in real time.
原创粉丝点击