SuRGeoNix / Flyleaf

Media Player .NET Library for WinUI 3/ WPF/WinForms (based on FFmpeg/DirectX)
GNU Lesser General Public License v3.0
712 stars 100 forks source link

How to send commands directly to FFMPEG engine while video is loaded and playing #437

Closed peteddevgithub closed 7 months ago

peteddevgithub commented 7 months ago

Hi @SuRGeoNix , Thanks for the brilliant library. Is it possible to send commands directly to the FFMPG lib engine both while a video is loaded and playing, and also when nothing is loaded or playing. With FFMPEG lib you can send commands to save video as different formats, or cut and save sections of the video or process effects on the video and audio like setting audio frequency filters for to eliminate background noise etc. Basically there a huge range of features in the lib that can be had by using command line parameters . How can I access and use all those FFMPEG features from this lib, both while video is loaded and playing, and/or while no video is loaded.

thanks

SuRGeoNix commented 7 months ago

Hi @peteddevgithub and thanks!

I'm not sure what do you mean by FFMPG lib but my guess is that you mean another library that uses command line to execute FFmpeg commands. So unfortunately is not that simple to mix those two but I'm planning to support FFmpeg deeper in the next major update (eg. video filters).

By the way, most of the video FFmpeg filters are not supporting D3D11 hardware acceleration which will drop the performance a lot. So the plan is to implement those independently within the D3D11 renderer.

peteddevgithub commented 7 months ago

Hello, thanks for your reply. I think its great you are adding support for Video filters. I apologize because my original question was unclear and had some typos that further confused what i was trying to ask. You use the FFmpeg library. If i was to download FFmpeg lib on its own (from its source website) i could use command line parameters to perform a variety of functions. An hypothetical example would be something like this Example1 : $ ffmpeg -i input.mp4 -ss 00:05:20 -t 00:10:00 -c:v copy -c:a copy output1.mp4 to trim a video file. or this Example 2: $ ffmpeg -i video.mp4 video.avi to convert the video file type. FFmpeg supports a large number of functions accessed in this way.

So what im trying to find out, given that your control already is using the FFmpeg lib, is there a way to send command parameters in this way to perform tasks that your control does not currently support.

So one example would be if a video is loaded or playing in your control, is there anyway to send command line parameters to the FFmpeg lib like example 1 above that would allow me to save out a chunk of the video to a new file, or save the video file as a new format.

I would like to be able to do that to video files that are both loaded and playing in the control, or just batch process files on a HD in the one application that hosts your control.

I hope that is clear what i am asking. To be able to send parameters to the FFmpeg lib you use in your control to perform custom functions or use features in FFmpeg that your video control does not currently support.

SuRGeoNix commented 7 months ago

@peteddevgithub I see your point now. However, FFmpeg has two parts: the API (DLLs) and the TOOL (exe). FlyleafLib uses the API and tries to provide higher API so you will not have to bother much about the complexity of the underlying FFmpegLib. Currently, is mainly for playback (means demuxing/decoding +seeking) and not much for encode/transcode/mux (just remuxing/downloading/recording). All those will be included in v4 (demux/decode/encode/mux/remux/transcode) and will support also multiple platforms and renderers (instead of using video filters so you can achieve hardware acceleration filtering).

(In your case you were asking for Player's Record function and Downloader class for remuxing, check the samples and let me know if you need specific help)