Home >Backend Development >PHP Tutorial >PHP uses ffmpeg to extract audio and video images from videos
If you want to extract the audio information from the video, the preferred technology is ffmpeg. ffmpeg is a very useful command line program that can be used to transcode media files. This article mainly introduces you to the relevant information on PHP using ffmpeg to extract audio and video images from videos. Friends in need can refer to it.
Preface
The name of FFmpeg comes from the MPEG video coding standard. The "FF" in front stands for "Fast Forward". FFmpeg is a set of An open source computer program used to record, convert digital audio and video, and convert it into streams. You can easily convert between multiple video formats.
FFmpeg users include Google, Facebook, Youtube, Youku, iQiyi, Tudou, etc.
Composition
## 1. libavformat: used to generate and parse various audio and video encapsulation formats, including obtaining the information required for decoding to generate Functions such as decoding context structures and reading audio and video frames, including demuxers and muxer libraries; 2. libavcodec: used for various types of sound/image encoding and decoding; 3. libavutil: including Some public toolsfunction;
4. libswscale: used for video scene scaling and color mapping conversion; 5. libpostproc: used for post-effects processing; 6. ffmpeg: It is a command line tool, used to convert video file formats, and also supports real-time encoding of TV cards; 7. ffsever: It is an HTTPMultimediaReal-time broadcast streaming server, supports time shifting;
8. ffplay: It is a simple player that uses the ffmpeg library to parse and decode, and displays through SDL;Extract audio and video images from videos
If you want to extract audio information from videos, the preferred technology is ffmpeg. Most of the ffmpeg usage tutorials on the Internet are:ffmpeg -i test.mp4 -vcodec copy -an video stream.avi
ffmpeg -i test.mp4 -acodec copy -vn audio stream.mp3
Invalid audio stream. Exactly one MP3 audio stream is required. could not write header for output file #0 (incorrect codec parameters ) invalid argument
ffmpeg -i test.mp4 Video stream.avi
ffmpeg -i test.mp4 audio stream.mp3
Summary
The above is the detailed content of PHP uses ffmpeg to extract audio and video images from videos. For more information, please follow other related articles on the PHP Chinese website!