[Audio and video] Qt introduced FFmpeg

Part related to audio and video are using the standard C ++, and only the interface will use part of the contents of Qt. This is to facilitate later ported to other systems.

 

  Development of audio and video codec is the most often do the operation. With H.264 as an example: If you want to implement your own coding h.264, H.264 requires very understanding. H.264 can choose to see the document, or you can use the source code someone else has written.

  Mainstream H.264 encoders: x264, t264 etc.

But for starters, because of the h.264 not know much about, so a bit difficult in the use of x264, a problem often do not know how to solve. And these libraries can only encoding format, so the start is not recommended.  And it recommends using FFMPEG.

 

FFMPEG  

  Various FFMPEG is an integrated codec library, can be said to be a versatile tool, from the video capture, video encoder to a video transmission (including RTP, RTCP, RTMP, RTSP protocol, etc.) can be used directly FFMPEG complete, more important point FFMPEG is cross-platform, Windows, Linux, Aandroid, IOS these mainstream take-all system. Therefore strongly recommended that the initial direct use FFMPEG.

 

1、下载FFMPEG:https://ffmpeg.zeranoe.com/builds/

  • Static: Static library version
  • Shared: DLL version
  • Dev: to provide developers with the lib file

Shared files and downloading files Dev

 Leaving only include and lib these two folders, others are deleted

 

 Create a pure Qt C ++ projects, link library file (lib folder in the file dev files) in the .pro file

 

 dll files and then shared / bin folder, and copied to the current project qt debug file

 

Test, prints the version number

execution_character_set #pragma ( "UTF-. 8") 
<the iostream> #include 
the using namespace STD; 

extern "C" 
{ 
#include "the libavcodec / for avcodec.h" 
#include "with libavformat / avformat.h" 
#include "libswscale / swscale.h " 
#include" libavdevice / avdevice.h " 
} 
/// C library and FFMPEG is 
/// As we build a C ++ project 
compiler /// compile time using the C ++ 
/// therefore need here plus extern "C" 
/// otherwise it will prompt a variety of undefined 

int main (int argc, char * argv []) 
{ 
    cout << "FFmpeg the Test!" << endl; 

    av_register_all (); 
    unsigned Version = avcodec_version ( ); 
    cout << "Version:" << Version;

    return 0;
}

 

 

Guess you like

Origin www.cnblogs.com/xiexinbei0318/p/11426110.html