php - FFMPEG create a demo file
Get the solution ↓↓↓From a given file (eg test.mp4) I want to create a new file with exact same properties (eg video rate, resolution etc) with the only difference to be the duration. eg 10 minutes while the original can be 2 hours.
This will helps me to create preview video files.
PS1: This conversion should be done within a PHP file, so I'll appreciate the code to be in PHP. PS2: For testing purposes the original file should be at /home/user/original and the new file must be at /home/user/demo
Thank you
Answer
Solution:
The Linux command to do it is:
ffmpeg -ss 00:00:01 -i Demo.mp4 -to 00:05:00 -c copy NewDemo.mp4
To execute this command from within a PHP file, the syntax is:
shell_exec('/usr/local/bin/ffmpeg -ss 00:00:01 -i /origin_folder/myvideo.mp4 -to 00:15:00 -c copy /destination_folder/mynewvideo.mp4 >/dev/null 2>/dev/null &');
Share solution ↓
Additional Information:
Link To Answer People are also looking for solutions of the problem: illegal string offset
Didn't find the answer?
Our community is visited by hundreds of web development professionals every day. Ask your question and get a quick answer for free.
Similar questions
Find the answer in similar questions on our website.
Write quick answer
Do you know the answer to this question? Write a quick response to it. With your help, we will make our community stronger.