To extract the audio information from the video, the preferred technique is that ffmpeg,ffmpeg is a very useful command-line program that can be used to transcode media files. This article mainly introduces the use of PHP FFmpeg extract video audio and video footage of the relevant information, the need for friends can refer to.
Objective
The name of FFmpeg comes from the MPEG video coding standard, the front "FF" stands for "Fast Forward", and FFmpeg is an open-source computer program that can be used to record, convert digital audio, video, and turn it into a stream. It is easy to convert multiple video formats to each other.
FFmpeg users have Google,facebook,youtube, Youku, iqiyi art, potatoes and so on.
Composition
1, Libavformat: For a variety of audio and video packaging format generation and resolution, including to obtain the information needed to decode the decoding context structure and read the audio and video frames and other functions, containing demuxers and Muxer library;
2, Libavcodec: For various types of sound/image codec;
3, Libavutil: Contains some common tool functions;
4, Libswscale: For video scene scaling, color mapping conversion;
5, Libpostproc: For the post-processing effect;
6, FFmpeg: is a command line tool for the video file conversion format, also supports real-time encoding of the TV card;
7, Ffsever: is an HTTP multimedia real-time broadcast streaming server, support time translation;
8, Ffplay: is a simple player, using the FFmpeg library parsing and decoding, through the SDL display;
Extracting audio and video footage from video
To extract the audio information from the video, the preferred technique is ffmpeg, and the vast majority of ffmpeg use tutorials on the Web are:
Like your file is Test.mp4.
Separate video out:ffmpeg -i test.mp4 -vcodec copy -an 视频流.avi
Separate the audio out:ffmpeg -i test.mp4 -acodec copy -vn 音频流.mp3
In this way, there is no problem in extracting the video. But when I extracted the 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, simply extracting the audio and video does not need to be so complicated, just execute the following two lines:
Separate video out:ffmpeg -i test.mp4 视频流.avi
Separate the audio out:ffmpeg -i test.mp4 音频流.mp3
Summarize