Home Backend Development PHP Tutorial Codeigniter tutorial: Upload video and use ffmpeg to convert flv example_PHP tutorial

Codeigniter tutorial: Upload video and use ffmpeg to convert flv example_PHP tutorial

Jul 13, 2016 am 10:37 AM
codeigniter ffmpeg flv Upload video

复制代码 代码如下:

$file = 'video_file';
$config['upload_path'] = './video_folder/';
$config['allowed_types'] = 'mov|mpeg|mp3|avi';
$config['max_size'] = '50000';
$config['max_width']   = '';
$config['max_height']   = '';

$this->upload->initialize($config);
$this->load->library('upload', $config);

if(!$this->upload->do_upload($file))
{
// If there is any error
$err_msgs .= 'Error in Uploading video '.$this->upload->display_errors().'
';
}
else
{
$data=array('upload_data' => $this->upload->data());
$video_path = $data['upload_data']['file_name'];
  $directory_path = $data['upload_data']['file_path'];
$directory_path_full      = $data['upload_data']['full_path'];
$file_name = $data['upload_data']['raw_name'];

// ffmpeg command to convert video

exec("ffmpeg -i ".$directory_path_full." ".$directory_path.$file_name.".flv");

// $file_name is same file name that is being uploaded but you can give your custom video name after converting So use something like myfile.flv.

/// In the end update video name in DB
$array = array(
'video' => $file_name.'.'.'flv',
);
$this->db->set($array);
$this->db->where('id',$id); // Table where you put video name
$query = $this->db->update('user_videos');
}

www.bkjia.comtruehttp://www.bkjia.com/PHPjc/735248.htmlTechArticle复制代码 代码如下: $file = 'video_file'; $config['upload_path'] = './video_folder/'; $config['allowed_types'] = 'mov|mpeg|mp3|avi'; $config['max_size'] = '50000'; $config['...
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

How to upload high-definition video tutorial on Douyin? How does it send 4K or 1080P? How to upload high-definition video tutorial on Douyin? How does it send 4K or 1080P? Mar 22, 2024 am 08:16 AM

As a leader in the field of short videos, Douyin’s clear video quality has been loved by a large number of users. On the Douyin platform, uploading high-definition videos allows users to more intuitively feel the richness and details of the content. So, how to upload high-definition video tutorials on Douyin? This article will introduce in detail the methods and precautions for uploading high-definition videos on the Douyin platform. 1. How to upload high-definition video tutorials on Douyin? To upload HD videos on the Douyin platform, you can follow these steps: 1. Shoot a video: When shooting a video, select HD mode. The default shooting quality of Douyin app is HD, with a resolution of 1080P. 2. Edit the video: On the Douyin editing page, click the "HD" button to ensure that the video quality is HD. 3. Post a video: When posting a video

Golang and FFmpeg: How to achieve audio mixing and separation Golang and FFmpeg: How to achieve audio mixing and separation Sep 27, 2023 pm 02:24 PM

Golang vs. FFmpeg: How to implement audio mixing and separation, specific code examples required Summary: Audio processing is an essential part of many multimedia applications. In Golang, we can use the FFmpeg library to achieve audio mixing and separation. This article will introduce how to use Golang to call the FFmpeg library to achieve audio mixing and separation, and provide specific code examples. By studying this article, readers will learn how to use Golang and FFmpeg to implement audio processing

How to implement custom middleware in CodeIgniter How to implement custom middleware in CodeIgniter Jul 29, 2023 am 10:53 AM

How to implement custom middleware in CodeIgniter Introduction: In modern web development, middleware plays a vital role in applications. They can be used to perform some shared processing logic before or after the request reaches the controller. CodeIgniter, as a popular PHP framework, also supports the use of middleware. This article will introduce how to implement custom middleware in CodeIgniter and provide a simple code example. Middleware overview: Middleware is a kind of request

Practice of video splicing using Golang and FFmpeg Practice of video splicing using Golang and FFmpeg Sep 28, 2023 am 08:37 AM

Practical introduction to video splicing using Golang and FFmpeg: In daily life, we often encounter situations where we need to merge multiple video files into one, such as splicing multiple recorded videos into a complete video file. To achieve this goal, this article will introduce how to use Golang and FFmpeg libraries to implement the video splicing process, and provide specific code examples. 1. What are Golang and FFmpeg? Golang (Go language) is an open source programming language developed by

iQiyi upload local video guide and how to use it iQiyi upload local video guide and how to use it Jan 16, 2024 pm 07:36 PM

During weekend leisure time, friends who like to binge-watch dramas, many of them should be using iQiyi Video. Although there are already many movie and TV series resources on iQiyi Video, there are always some that may not be available. For those video resources that cannot be found on iQiyi Video, many friends will download them through other channels and then want to play them on their mobile phones using iQiyi Video. So what should we do? Below I will introduce to you how to open and upload local videos to iQiyi Video on your mobile phone. How to open local videos in iQiyi Mobile? First, open the iQiyi app on your phone, then click the "My" button at the bottom to jump to my page, and then select the "Download" option. Step 2: After entering the download page, please click the three buttons in the upper right corner of the page. indivual

Golang and FFmpeg: How to implement audio format conversion and compression Golang and FFmpeg: How to implement audio format conversion and compression Sep 28, 2023 pm 07:13 PM

Golang and FFmpeg: How to implement audio format conversion and compression, specific code examples are needed. Introduction: In audio file processing, sometimes you encounter the need to convert audio formats or compress audio file sizes. As a powerful programming language, Golang, combined with FFmpeg, a popular audio and video processing tool, can achieve fast and efficient audio format conversion and compression. This article will introduce how to use Golang and FFmpeg to achieve audio format conversion and compression, and give specific code examples.

Golang and FFmpeg: How to implement audio synthesis and segmentation Golang and FFmpeg: How to implement audio synthesis and segmentation Sep 27, 2023 pm 10:52 PM

Golang and FFmpeg: How to implement audio synthesis and segmentation, specific code examples are required Summary: This article will introduce how to use Golang and FFmpeg libraries to implement audio synthesis and segmentation. We will use some specific code examples to help readers understand better. Introduction: With the continuous development of audio processing technology, audio synthesis and segmentation have become common functional requirements in daily life and work. As a fast, efficient and easy to write and maintain programming language, Golang, coupled with FFmpeg

CodeIgniter middleware: Accelerate application responsiveness and page rendering CodeIgniter middleware: Accelerate application responsiveness and page rendering Jul 28, 2023 pm 06:51 PM

CodeIgniter Middleware: Accelerating Application Responsiveness and Page Rendering Overview: As web applications continue to grow in complexity and interactivity, developers need to use more efficient and scalable solutions to improve application performance and responsiveness. . CodeIgniter (CI) is a lightweight PHP-based framework that provides many useful features, one of which is middleware. Middleware is a series of tasks that are performed before or after the request reaches the controller. This article will introduce how to use

See all articles