How php uses ffmpeg to extract audio and video images in a video.
Preface
The name of FFmpeg comes from the MPEG video encoding standard. The previous "FF" indicates "Fast Forward". FFmpeg is a set of functions that can be used to record and convert digital audios and videos, and can be converted into open-source computer programs of the stream. You can easily convert multiple video formats.
FFmpeg users include Google, Facebook, Youtube, Youku, iQiYi, and Tudou.
Composition
1. libavformat: used to generate and parse audio and video encapsulation formats, including obtaining the information required for decoding to generate the decoding Context Structure and reading audio and video frames, including demuxers and muxer libraries;
2. libavcodec: used for various types of sound/Image Coding/decoding;
3. libavutil: contains some common tool functions;
4. libswscale: used for proportional scaling and color ing conversion in video scenarios;
5. libpostproc: used for post-effect processing;
6. ffmpeg: it is a command line tool used to convert the video file format. It also supports real-time Encoding of video cards;
7. ffsever: an HTTP multimedia real-time broadcast stream server that supports time translation;
8. ffplay: A simple player that uses the ffmpeg library for parsing and decoding and is displayed through SDL;
Extract audio and video images from a video
To extract Audio Information from a video, ffmpeg is the preferred technology. Most ffmpeg tutorials on the Internet are as follows:
For example, your file is test.mp4.
Separate the video:Ffmpeg-I test.mp4-vcodec copy-an video stream. avi
Separate audio:Ffmpeg-I test.mp4-acodec copy-vn Audio Frequency
There is no problem in extracting videos using this method. However, when extracting audio, I encountered the following error:
Invalid audio stream. Exactly one MP3 audio stream is required. could not write header for output file #0 (incorrect codec parameters ) invalid argument
In fact, simple extraction of audio and video does not need to be so complicated. You only need to execute the following two lines:
Separate the video:Ffmpeg-I test.mp4 video stream. avi
Separate audio:Ffmpeg-I test.mp4 audio and video frequency
Summary
The above is all the content of this article. I hope the content of this article will help you in your study or work. If you have any questions, please leave a message, thank you for your support.