How to generate Supercut of video in laravel? - laravel

I want to generate supercut of video max duration 30 seconds. I am new to laravel could anyone help me with this

PHP does not provide any built in functionality to achieve video manipulating. So using a third party is required.
PHP-FFMPEG library is a video/audio library. It does many common video-editing tools including taking shots of particular frame(s).
notice that you need to have FFMpeg binary on your machine as documentation sais:
This library requires a working FFMpeg install. You will need both FFMpeg and FFProbe binaries to use it. Be sure that these binaries can be located with system PATH to get the benefit of the binary detection, otherwise you should have to explicitly give the binaries path on load.
after configuration completed you can take frame shots easily:
$video
->filters()
->extractMultipleFrames(FFMpeg\Filters\Video\ExtractMultipleFramesFilter::FRAMERATE_EVERY_10SEC, '/path/to/destination/folder/')
->synchronize();
$video
->save(new FFMpeg\Format\Video\X264(), '/path/to/new/file');
Good Luck

Related

How can I download the libsvt_hevc library on ffmpeg on a Mac?

I need to perform Scalable Video Encoding on a video using ffmpeg. In order to do so, I need to have the libsvt_hevc library. So any idea how add this library to Ffmpeg on a Mac?
I tried downloading the library but none of the links available online are suitable for Mac.

Extract raw audio frames from OGG music file with Android NDK

In my Android app, I would like to be able to process audio on the fly from an OGG file by extracting audio samples, process them and redirect them to the audio output.
I know how to make the last 2 steps using Android NDK, but I don't know how to extract audio samples to get them in an array of floats or shorts.
I tried to make this code work that, apparently, can extract raw audio samples on the fly.
The problem is: I don't manage to add FFMpeg in my project. I tried many tutorials (like this one), but it seems pretty difficult since I work on Windows. So after a while, I found Prebuild FFMpeg for Android, that seems interesting since it's available for armeabi-v7a, arm64-v8a, x86 and x86_64 architectures, but again, I don't understand how to add it in my project.
I also took a look at libogg, libvorbis and vorbisfile, but I have no idea how to add them in my project.
So, does anyone have a working example on how to extract audio samples from an OGG file on the fly?
Thanks for your help.
Here is how I finally managed to proceed:
Here is a very detailed tutorial that explains clearly how to compile FFMpeg for Android (please take a close look at the comments): https://www.youtube.com/watch?v=2OGbamEjYhc
Then, here is a good tutorial that explains how to implement the FFMpeg library in an Android project (starting from "Integration of pre-built C/C++ libraries to an Android project"): https://proandroiddev.com/android-ndk-how-to-integrate-pre-built-libraries-in-case-of-the-ffmpeg-7ff24551a0f
Here is how I finally managed to extract audio samples from an audio file using FFMpeg: https://gist.github.com/mregnauld/2538d98308ad57eb75cfcd36aab5099a
For the step #2, you'll just have to make minor updates so you can target the following ABIs:
armeabi-v7a
arm64-v8a
x86
x86_64
Hope this helps.

Is it possible to retrieve the "profile" of one file, and use it to convert another file?

So we have an ancient compiled program that has been converting AVI files to MPEG for television broadcast. The program is pure sorcery, as the original programmer is long gone, but it has created 10's of thousands of MPEG files of a very particular format that our (also ancient) broadcast server uses.
So...the question is whether or not, we can use FFMPEG to initially "get the details" of one of those MPEG files, and use THAT to convert future MP4 files to that legacy MPEG format?
In short, we don't know all the intricacies of everything that the program is or may be doing, and want to replace it with FFMPEG, being confident that we're getting exactly the same output that works without a hitch in the fussy broadcast server.
FFmpeg cannot automatically retrieve and store all information from an existing file which is salient to reproducing those features in a new instance.
ffprobe or ffmpeg will show you basic stream and metadata information but that information has to be parsed outside of ffmpeg and then a conversion command manually crafted to reproduce those properties. However, this is only a start. There may be many aspects, like those related to flags, headers and packetization that ffprobe won't show, and which a fussy consumer expects in a certain way.
FFmpeg should be able to produce a standard vanilla file. You mention 'MPEG' but that could refer to MPEG-1/2 Program Stream (ISO 11172) or Transport Stream (ISO 13818). The latter is still widely produced & used and you should be able to find multiple software, FLOSS or otherwise, that produce it.
You can use ffprobe to get information about any AV media file and retain this information for later use:
https://www.ffmpeg.org/ffprobe.html
https://trac.ffmpeg.org/wiki/FFprobeTips
If you have ffmpeg installed on your system than ffprobe should already be installed ...

fragmented mp4 javascript converting

I wanted to know if there is a way to convert regular mp4 to a fragmented mp4 via javascript. (like mp4box does) Is it efficient enough (not suppose to be a complicated task)? did anyone write something like this?
to make it harder, can it be on the fly? meaning I will not download the whole mp4 from the server but download in parts and convert it into fragments compatible with fragmented mp4 and mpeg-dash - I'm trying to overcome to problem to not have to use 2 different file types to play a video or do mp4box on all my library in advance.
Regardless, is it possible to convert from h.264 compatible files with different containers (mov, flv etc.) to fragmented without a server? meaning do it in the browser with javascript somehow?
appreciate the help,
Yug
I am working on something similar (which lead me to here) but no clue so far. However, below is my finding:
Broadway:
https://github.com/mbebenita/Broadway
The idea is you may write a C/C++ using FFMPEG source library, then use Emscripten to compile your C/C++ coding into Javascript. I yet start working with this method, not sure this will work or not. If you did do let me know.

Selecting a library / framework for video capture & recording

In one of the project that we have undertaken we are looking for a video capture & recording library. Our groundwork (based on google search) shows that vlc (libvlc), ffmpeg (libavcodec) and gstreamer are the three popular free and open source libraries / multimedia frameworks available for the same. How do these libraries compare on the following parameters:
Licensing policy to allow use within a commercial product without the need to open source any of the components of the product that is using the library
Ability to be used effectively in a multi-threaded environment (library should be inherently thread-safe)
Easy to use and maintain
Documentation: API should be well documented...this is relative...:)
Our primary intention is to be able to capture RTSP video streams (H.264/MPEG-2/MJPEG encoded), convert these streams to raw video / frames so that it can be used for analysis / processing and later on compress these frames and store it on the disk in the form of an MP4 file (using MPEG2 / H.264 encoding).
P.S. We understand that FFmpeg is also one of the components of vlc since vlc uses libavcodec library. Is the same true for gstreamer as well? Does it have any ffmpeg dependency?
Awaiting your responses.
Regards,
Saurabh Gandhi
I suggest you to use Gstreamer.
Gstremer is multimedia framework and it has so many plug-in for various task. Plugin are one type of library. And for Capturing rtsp , converting raw video , and muxing in mp4 all have i think you will easily find out the best plug-in in Gstermer. yOU just need to write one application for this.
1. Licensing policy to allow use within a commercial product without
the need to open source any of the components of the product that is
using the library
i dont know much about this
2. Ability to be used effectively in a multi-threaded environment
(library should be inherently thread-safe)
yea Gstremer internally take care for all threading.
3. Easy to use and maintain
yea Gstremer is easy to use and maintain
4. Documentation: API should be well documented...this is relative...:)
yea Gstremer has verry well managed documented API
No Gstermer framework has no dependency on ffmpeg.but Actualy gstremer has some plugin which are based on ffmpeg. that is gst-ffmpeg

Resources