PHP implements the method of converting video into MP4 and obtaining a video preview _php tips

Source: Internet
Author: User

This article illustrates how PHP implements a video to MP4 and get a video preview. Share to everyone for your reference. The implementation methods are as follows:

Copy Code code as follows:
<?php
Flv_convert_get_thumb (' Input.avi ', ' output.jpg ', ' OUTPUT.OGM ');
Code provided and updated by Steve of Phpsnaps! Thanks
Accepts:
1:the Input Video File
2:path to Thumb jpg
3:path to transcoded MPEG?
function Flv_convert_get_thumb ($in, $out _thumb, $out _vid)
{
Get thumbnail
$cmd = ' ffmpeg-v 0-y-i '. $in. '-vframes 1-ss 5-vcodec mjpeg-f rawvideo-s 286x160-aspect 16:9 '. $out _thumb;
$res = Shell_exec ($cmd);
$res is the output of the command
Transcode Video
$cmd = ' mencoder '. $in. $out _vid-af volume=10-aspect 16:9-of AVI-NOODML-OVC x264-x264encopts El_idc=41:bframes=3:frameref=2:nopsnr:nossim:pass=1:threads=auto-oac Mp3lame ';
$res = Shell_exec ($cmd);
}
?>

I hope this article will help you with your PHP program design.

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.