How php uses ffmpeg to extract audio and video images in a video.

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.