FFmpeg development notes (11): ffmpeg is ported to the HiSilicon HI35xx platform and the ffmpeg library is introduced into the demo of the sample

If the article is an original article, please indicate the source of
the original article when reprinting
. Find professionals, or study
the blog post of Red Fatty (Red Imitation) by yourself: development technology collection (including Qt practical technology, Raspberry Pi, 3D, OpenCV, OpenGL, ffmpeg, OSG, microcontroller, combination of software and hardware, etc.) Continuously updated Middle... (click on the portal)

FFmpeg and SDL development column (click the portal)

Previous: " FFmpeg Development Notes (10): Cross-compilation of ffmpeg on ubuntu and porting to HiSilicon HI35xx platform "
Next: Stay tuned...


foreword

  The previous article cross-compiled the HiSilicon version of ffmpeg, and used the cross-compiled qt ffmpeg player to play on HiSilicon. This film adds the ffmpeg environment to the HiSilicon sample environment.


Introduce the ffmpeg library in the HiSilicon sample

Step 1: View the previously cross-compiled installation files

  insert image description here

Step 2: Open the compiled parameter file, add header files and library files

   insert image description here

##### add by yangjiong 2022-03-12 start
INC_FLAGS += -I/home/yang/work/ffmpeg-hi3559av100/include
MPI_LIBS += /home/yang/work/ffmpeg-hi3559av100/lib/libavcodec.a
MPI_LIBS += /home/yang/work/ffmpeg-hi3559av100/lib/libavdevice.a
MPI_LIBS += /home/yang/work/ffmpeg-hi3559av100/lib/libavfilter.a
MPI_LIBS += /home/yang/work/ffmpeg-hi3559av100/lib/libavformat.a
MPI_LIBS += /home/yang/work/ffmpeg-hi3559av100/lib/libavutil.a
MPI_LIBS += /home/yang/work/ffmpeg-hi3559av100/lib/libswresample.a
MPI_LIBS += /home/yang/work/ffmpeg-hi3559av100/lib/libswscale.a
##### add by yangjiong 2022-03-12 stop

  As shown below:
  insert image description here

Step 3: Add ffmpeg test in another sample in venc

  (Note that in the sample subdirectory of HiSilicon, the folder can only have one main function, which means that all header files and source files in the subfolder will be jointly compiled as an application.)
  Change the original .c About the suffix .bak, and then re-create a c file.
  insert image description here
  insert image description here

Step 4: Run the target application on the board

  (Note: You need to add the library to the running environment first. The easiest way is to copy the previous library directly, put the lib in the /lib file directory of the HiSilicon system, or you can customize the path, and use the script to add it first at runtime. Path and then run the application, there are many ways, all roads lead to Rome).
  The results of running on HI3559AV100 are as follows:
  insert image description here


Demo source code

#ifdef __cplusplus
#if __cplusplus


extern "C" {
    
    
#endif
#endif /* End of #ifdef __cplusplus */

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <pthread.h>
#include <signal.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#include <netinet/in.h>
#include<arpa/inet.h>
#include <sys/types.h>

#include "sample_comm.h"

// ffmepg
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libswscale/swscale.h>
#include <libavdevice/avdevice.h>
#include <libavformat/version.h>
#include <libavutil/time.h>
#include <libavutil/mathematics.h>

#define LOG printf("%s:%d\n", __FILE__, __LINE__);


int main(int argc, char *argv[])
{
    
    
	printf("%s\n", avcodec_configuration());
	return 0;
}

#ifdef __cplusplus
#if __cplusplus
}
#endif
#endif /* End of #ifdef __cplusplus */

Previous: " FFmpeg Development Notes (10): Cross-compilation of ffmpeg on ubuntu and porting to HiSilicon HI35xx platform "
Next: Stay tuned...


If the article is an original article, please indicate the source of
the original article when reprinting. The blog address of this article: https://blog.csdn.net/qq21497936/article/details/123446550

Guess you like

Origin blog.csdn.net/qq21497936/article/details/123446550