surgeonix / flyleaf Goto Github PK
View Code? Open in Web Editor NEWMedia Player .NET Library for WinUI 3/ WPF/WinForms (based on FFmpeg/DirectX)
License: GNU Lesser General Public License v3.0
Media Player .NET Library for WinUI 3/ WPF/WinForms (based on FFmpeg/DirectX)
License: GNU Lesser General Public License v3.0
Hi,
can i modify your code to play video at higher speed ?
When calling NormalScreen(), the ResizeMode, WindowStyle and WindowState properties are reset. These settings should be cached when switching to fullscreen, so they can be re-applied when switching back to normal screen.
Hi,
I am trying your code on a PC with 2 processors. Although video source is 25 fps but your app only display at ~ 5 fps.
After changed to DateTime.UtcNow.Ticks it's correct.
reference: http://kristofverbiest.blogspot.com/2008/10/beware-of-stopwatch.html
Hi,
Seem your project cannot play if video don't have audio stream.
Please check
Hi brother!
Thank for your project.!
i'm try to play the video and want to change Speed Up or down for player and adjusting the Pitch-Shift for audio. I have tried adding soundtouch.dll library but the result is not as expected. Can you add these functions to the player?
thank you so much!
Hi,
When playing video, CPU around 0.3 % but when video finished, CPU usage raise to 17%.
When i doubleclick or click on fullscreen button it wont hide taskbar from windows.
Tested in my app and latest compiled example.
Please check:
// We use 3 * max queue size for live streaming (currently live stream means duration = 0 | possible check if hls?)
// We need to ensure that we have also enough Audio Samples (for embedded audio stream) - is it possible to calculate this?
while (type == AVMEDIA_TYPE_VIDEO && dec.isRunning && dec.player.vFrames.Count > (dec.player.Duration == 0 ? dec.player.VIDEO_MIX_QUEUE_SIZE * 3 : dec.player.VIDEO_MIX_QUEUE_SIZE))
Thread.Sleep(5);
Describe the bug
Originally found in Race Control( robvdpol/RaceControl#195 and robvdpol/RaceControl#196), traced back to Flyleaf.
This bug has two sides to it.
With Windows Volume Mixer you can set the volume level for each individual application.
Problem 1:
When you set Flyleaf's volume in the mixer to something and reopen Flyleaf, the volume is always set back to 100.
Problem 2:
When Flyleaf is open the above problem also occurs for every other application you open which uses the same sound source.
This only happens to applications which get start after Flyleaf was started, so applications which were already running do not get reset.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The expected behaviour is that the default behaviour for set volumes for the different application in the volume mixer do not get affected by Flyleaf.
Screenshots
Start situation:
After reproduction:
Additional context
Upon investigation in the code the problems occurs in AudioMaster.cs in the OnSessionCreated delegate:
Flyleaf/FlyleafLib/AudioMaster.cs
Lines 115 to 123 in 5981a5b
Flyleaf/FlyleafLib/AudioMaster.cs
Line 120 in 5981a5b
Once Flyleaf is running every new audio session will be caught by NAudio. This causes problem 2.
You can test this by setting a breakpoint in the above function and starting a any new application (which uses audio) while it is debugging.
I feel like it is not necessary to set the volume here since the default volume for windows applications will be set to 100 anyway.
A different way to fix this is to not handle the audio events which are not coming from Flyleaf (or applications which implement Flyleaf), but I think not setting the volume to 1 is way simpler for now.
Format : Matroska
Format version : Version 4 / Version 2
File size : 1.68 GiB
Duration : 1 h 50 min
Overall bit rate : 2 191 kb/s
Writing application : mkvmerge v42.0.0 ('Overtime') 64-bit
Writing library : libebml v1.3.10 + libmatroska v1.5.2
Cover : Yes
Attachments : cover.jpg / small_cover.jpg / cover_land.jpg / small_cover_land.jpg
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : [email protected]
Format settings, CABAC : Yes
Format settings, RefFrames : 4 frames
Codec ID : V_MPEG4/ISO/AVC
Duration : 1 h 50 min
Bit rate : 2 000 kb/s
Width : 1 920 pixels
Height : 800 pixels
Display aspect ratio : 2.40:1
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.054
Stream size : 1.53 GiB (91%)
Default : Yes
Forced : No
Color range : Limited
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
Audio
ID : 3
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : HE-AAC / LC
Codec ID : A_AAC
Duration : 1 h 50 min
Bit rate : 192 kb/s
Channel(s) : 6 channels
Channel positions : Front: L C R, Side: L R, LFE
Sampling rate : 48.0 kHz / 24.0 kHz
Frame rate : 23.438 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 151 MiB (9%)
Language : English
Default : No
Forced : No
Hi
Does Flyleaf have an ability to Zoom/Pan on Video ?
If not, can I request that it be considered ?
I tried to create a player in the background code. I found that every time I created it, the memory could not be released normally.
How can I improve it?
Thank you.
using FlyleafLib 3.1.0 from nuget
MainWindow.xaml:
<Window
x:Class="FlyleafLib.Test.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="MainWindow"
Width="800"
Height="450"
mc:Ignorable="d">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Button Click="ButtonNew_OnClick">
Create New Instance
(1. each click leak some memory,
2. click in quick succession the program crashes )
</Button>
<ContentControl
x:Name="ContentControl"
Grid.Row="1"
HorizontalAlignment="Stretch"
VerticalAlignment="Stretch" />
</Grid>
</Window>
MainWindow.xaml.cs
using System;
using System.IO;
using System.Threading.Tasks;
using System.Windows;
using FlyleafLib.Controls.WPF;
using FlyleafLib.MediaPlayer;
namespace FlyleafLib.Test
{
public partial class MainWindow
{
public Player Player { get; set; }
public MainWindow()
{
InitializeComponent();
Master.RegisterFFmpeg(":2");
}
private FlyleafLib.Controls.WPF.VideoView _videoView;
private FlyleafLib.MediaPlayer.Player _player;
private FlyleafLib.Controls.WPF.Flyleaf _flyleaf;
private async void ButtonNew_OnClick(object sender, RoutedEventArgs e)
{
_player?.Stop();
await Task.Run(() => _player?.Dispose());
_videoView = new VideoView();
_videoView.UpdateDefaultStyle();
_videoView.ApplyTemplate();
_flyleaf = new Flyleaf();
_videoView.Content = _flyleaf;
Config config = new Config();
config.demuxer.VideoFormatOpt.Add("probesize", (50 * (long) 1024 * 1024).ToString());
config.demuxer.VideoFormatOpt.Add("analyzeduration", (10 * (long) 1000 * 1000).ToString());
_player = new Player(config);
_videoView.BeginInit();
_player.Control = _videoView.FlyleafWF;
_videoView.Player = _player;
_flyleaf.Player = _player;
ContentControl.Content = _videoView;
_player.Open(@"VIDEO FILE");
_player.Play();
}
}
}
default value of Decoder.MaxVideoFames
(Environment.ProcessorCount)
is less then MinVideoFrames
As the title says i've tried to change the resolution of an youtube stream with last 3.1 version and it doesnt work.
Thread Abort on AVIO Contexts will make the decoder read invalid bytes and crashes the whole session (need to implement proper abort for decoder)
Hello:
I happen to find your repo, and it seems to be interesting. However, as it is rather complicated,
I can’t figure out yet how to download multiple M3U8 videos and save to local hard drive.
For example, I have the following 2 M3U8 videos in the URL:
http://demo.unified-streaming.com/video/tears-of-steel/tears-of-steel.ism/.m3u8
http://devimages.apple.com/iphone/samples/bipbop/bipbopall.m3u8
I want to launch 2 clients to download them at the same time, when finished, I want to save the files as local files: C:\1.mp4 and C:\2.mp4 and stop or dispose the client.
Please show me how I can do this with C#.
By the way, I am using Windows 10 Version 21H1, and Visual Studio 2019 Version 16.10.4.
Thanks,
When I start Playing Udp stream video and After 5 minutes of streaming the App enter Infinite Loop in Media Buffer function that has been called in Screamer() function in this part
if (requiresBuffering)
{
totalBytes = decoder.VideoDemuxer.TotalBytes + decoder.AudioDemuxer.TotalBytes + decoder.SubtitlesDemuxer.TotalBytes;
videoBytes = decoder.VideoDemuxer.VideoBytes + decoder.AudioDemuxer.VideoBytes + decoder.SubtitlesDemuxer.VideoBytes;
audioBytes = decoder.VideoDemuxer.AudioBytes + decoder.AudioDemuxer.AudioBytes + decoder.SubtitlesDemuxer.AudioBytes;
MediaBuffer();
requiresBuffering = false;
if (seeks.Count != 0) continue;
if (vFrame == null) { Log("MediaBuffer() no video frame"); break; }
}
vFrame is null and no statement is true in this part
else
{
if (!decoder.VideoDecoder.IsRunning && !isVideoSwitch) { Log("[SCREAMER] Video Exhausted"); shouldStop= true; }
if (vFrame != null && !gotAudio && (!decoder.AudioDecoder.IsRunning || decoder.AudioDecoder.Demuxer.Status == MediaFramework.MediaDemuxer.Status.QueueFull)) {
Log("[SCREAMER] Audio Exhausted"); gotAudio = true; }
}
wpf:Layout exception in Viewbox
<Window ...... Height="450" Width="800"> <Viewbox> <Grid Height="450" Width="800"> <fl:VideoView x:Name="flview"> <Grid> <Image Source="NoneCCTV.png"/> </Grid> </fl:VideoView> </Grid> </Viewbox> </Window>
Hello:
I can’t find a C# code sample on how to extract all frames from one MP4 video file. (C:\Videos\1.mp4).
I want to extract all the frames from the MP4 video file and save them (in PNG format) in one local folder. (C:\VideoFrames).
Please advise!
My OS is Windows 10 (Version 21H1), IDE is Visual Studio 2019 (version 16.10.4)
Hi,
Issue:
To test I am create a method Close() on MediaDecoder.cs and Stop() on MediaRouter.cs but when press a key to stop video, the memory only reduce at 144 MB.
How to release all memory when stop video or video finished and clear screen (black color) at the end ?
// MediaRouter.cs
public void Stop()
{
decoder.Close();
Close();
}
// MediaDecoder.cs
public void Close()
{
video?.Dispose();
video = null;
audio?.Dispose();
audio = null;
if (swsCtx != null)
{
sws_freeContext(swsCtx);
swsCtx = null;
}
if (vCodecCtx != null)
{
avcodec_close(vCodecCtx);
vCodecCtx = null;
}
if (aCodecCtx != null)
{
avcodec_close(aCodecCtx);
aCodecCtx = null;
}
}
Hello:
I found the latest version of Flyleaf release from this URL:
https://github.com/SuRGeoNix/Flyleaf/releases/download/v3.1.14/Flyleaf_v3.1.14.7z
I can download and unzip the compressed folder, and I can run FlyleafPlayer.exe (file version 1.0.0.0) and drag one video file and drop into it, so the player will play the video.
It looks well.
However, what I want is that I can insert such Player as a WinForms user control, and I can add one textbox, which I can input a local video file name, then and one button, which I can click on the button, so the Flyleaf Player user control can play the video file which is retrieved from textbox, as I can see from the FlyleafPlayer.exe interface, there are seeker control, I can use to play the video from anywhere I want.
But how I can add it as a user control to the Visual Studio Designer’s toolbox? (Visual Studio 2019)
Thanks,
Hello.
First of all, thank you for your great project.
We are currently working on a video player project, and trying to use this project as a baseline.
I understand the video sync method with pts, but I don't understand how you synchronize audio with pts.
Can you explain how to sync audio?
The code block I don't understand is
if (decoder.hasAudio)
{
// Audio Sync
if (Math.Abs((audioDelayTicks - delayTicks) / 10000) > 220)
{
if (curTicks + audioExternalDelay < decoder.aStreamInfo.startTimeTicks || curTicks + audioExternalDelay > decoder.aStreamInfo.durationTicks)
audioDelayTicks = -10000000; // Force Resync Later (Audio Paused)
else if (ResynchAudio(curTicks - audioExternalDelay)) audioDelayTicks = delayTicks;
}
// Audio Frames [Callback]
if ( aFrames.Count > 0) SendAudioFrames();
}
when I use the rtsp url,it can't play it?
I have done the following in order to use your repo in C# console project (target .NET 5.0)
Download and unzip ffmpeg full build file from this URL:
https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7z
Copy the unzipped folder to C:\Program Files
Edit System PATH variable to add ffmpeg binary path.
I have installed nuget packages:
PM> Install-Package FFmpeg.AutoGen -Version 4.4.0
PM> Install-Package NAudio.Wasapi -Version 2.0.0
PM> Install-Package SharpDX.Mathematics -Version 4.2.0
PM> Install-Package FlyleafLib -Version 3.1.12
PM> Install-Package FlyleafLib.Controls.WPF -Version 1.1.4
Before going further, I found the following warnings:
For both FlyleafLib & FlyleafLib.Controls.WPF, I saw yellow color icon next to the both, showing:
Warning NU1701 Package 'FlyleafLib 3.1.12' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net5.0'. This package may not be fully compatible with your project.
Warning NU1701 Package 'FlyleafLib.Controls.WPF 1.1.4' was restored using '.NETFramework,Version=v4.6.1, .NETFramework,Version=v4.6.2, .NETFramework,Version=v4.7, .NETFramework,Version=v4.7.1, .NETFramework,Version=v4.7.2, .NETFramework,Version=v4.8' instead of the project target framework 'net5.0'. This package may not be fully compatible with your project.
For the above warnings, can you please make new nuget package to target .NET 5.0?
I have written the following C# code, trying to download one M3U8 URL to local hard drive.
using FlyleafLib;
using FlyleafLib.MediaFramework.MediaDemuxer;
using System;
using System.Threading.Tasks;
namespace FlyleafDownloadTest1
{
class Program
{
public const string FFMPEG_Binary = @"C:\Program Files\ffmpeg-4.4-full_build\bin";
public const string Output_File1 = @"C:\Videos\FFMPEG\Download1.mp4";
private static void Downloader1_DownloadCompleted(object sender, bool success)
{
if (success)
{
Console.WriteLine("Partial/Live Download Completed!");
}
else
Console.WriteLine("Download Failed!");
}
static async Task Main(string[] args)
{
Master.RegisterFFmpeg(FFMPEG_Binary);
DemuxerBase Downloader1 = new VideoDemuxer(new Config(), 1);
Downloader1.DownloadCompleted += Downloader1_DownloadCompleted;
string url1 = @"https://www.rmp-streaming.com/media/big-buck-bunny-360p.mp4";
if (Downloader1.Open(url1) != 0)
{ Console.WriteLine("Could not open url input"); return; }
Downloader1.EnableStream(Downloader1.VideoStreams[0]);
if (Downloader1.AudioStreams.Count != 0)
Downloader1.EnableStream(Downloader1.AudioStreams[0]);
Downloader1.Download(Output_File1);
await Task.Delay(10000);
if (Downloader1.Url.Contains("bunny"))
Downloader1.Stop();
Console.WriteLine("Done!");
}
}
}
I just want to see if I can use your repo to download M3U8 URL to local hard disk in C# console project, without using any GUI interface. I think this could be very basic usage, if successful, I can use it somewhere else, like WinForm project. But I don’t like WPF, as there are too many restrictions.
However, when I run my code, I got a lot of this type errors:
System.Exception
HResult=0x80131500
Message=Failed to register FFmpeg libraries
Source=FlyleafLib
StackTrace:
at FlyleafLib.Master.RegisterFFmpeg(String absolutePath, Int32 verbosity)
at FlyleafDownloadTest1.Program.
This exception was originally thrown at this call stack:
[External Code]
Inner Exception 1:
DllNotFoundException: Unable to load DLL 'avformat.58 under C:\Program Files\ffmpeg-4.4-full_build\bin': The specified module could not be found.
I have tried to search such files and copy them to C:\Program Files\ffmpeg-4.4-full_build\bin, but this types of error seem never end.
This is what I can see inside the full build of FFMPEG:
C:\Users\John>ffmpeg -version
ffmpeg version 4.4-full_build-www.gyan.dev Copyright (c) 2000-2021 the FFmpeg developers
built with gcc 10.2.0 (Rev6, Built by MSYS2 project)
configuration: --enable-gpl --enable-version3 --enable-static --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libdav1d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libaom --enable-libopenjpeg --enable-libvpx --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libmfx --enable-libglslang --enable-vulkan --enable-opencl --enable-libcdio --enable-libgme --enable-libmodplug --enable-libopenmpt --enable-libopencore-amrwb --enable-libmp3lame --enable-libshine --enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc --enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex --enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite --enable-libmysofa --enable-librubberband --enable-libsoxr --enable-chromaprint
libavutil 56. 70.100 / 56. 70.100
libavcodec 58.134.100 / 58.134.100
libavformat 58. 76.100 / 58. 76.100
libavdevice 58. 13.100 / 58. 13.100
libavfilter 7.110.100 / 7.110.100
libswscale 5. 9.100 / 5. 9.100
libswresample 3. 9.100 / 3. 9.100
libpostproc 55. 9.100 / 55. 9.100
C:\Users\John>
From my understanding, the full build seem contain all necessary modules your repo needs, but maybe in different format.
Please check and let me know how I can proceed with my simple project.
Thanks,
When I resize the player window the zoom is reset.
Hi,
I am testing your project on some PCs, application can not start if DirextX version is 10.0.
So, I modified like that in Initialize() and it worked:
string vertexProfile = "vs_5_0";
string pixelProfile = "ps_5_0";
if (device.FeatureLevel == SharpDX.Direct3D.FeatureLevel.Level_9_1 ||
device.FeatureLevel == SharpDX.Direct3D.FeatureLevel.Level_9_2 ||
device.FeatureLevel == SharpDX.Direct3D.FeatureLevel.Level_9_3 ||
device.FeatureLevel == SharpDX.Direct3D.FeatureLevel.Level_10_0 ||
device.FeatureLevel == SharpDX.Direct3D.FeatureLevel.Level_10_1)
{
vertexProfile = "vs_4_0_level_9_1";
pixelProfile = "ps_4_0_level_9_1";
}
var VertexShaderByteCode = ShaderBytecode.Compile(Properties.Resources.VertexShader, "main", vertexProfile, ShaderFlags.Debug);
var PixelShaderByteCode = ShaderBytecode.Compile(Properties.Resources.PixelShader, "main", pixelProfile, ShaderFlags.Debug);
var PixelShaderByteCodeYUV = ShaderBytecode.Compile(Properties.Resources.PixelShader_YUV, "main", pixelProfile, ShaderFlags.Debug);
Hi,
can you add some events of player as: OnTimeChanged (for trackbar), OnFinished (for play next file), OnError (for write error log to file), OnStateChanged (Playing, Pause, Error,...) , OnDisconnected, OnNewFrame,...
Hello:
I have 2 video files, they are using the same video format (I can ignore the audio for now). They are like: C:\Videos\A.mp4, and C:\Videos\B.mp4.
I want to know if I can use your repo to merge the A.mp4 and B.mp4 to make a new video file, called: C:\Videos\Merge.mp4?
I think I can use FFMPEG command to do this, but as I have many of such files, like a few hundreds, so I want to have some program to make the process faster.
Please share some code samples, if possible.
Thanks,
Hi,
This issue has been reported before #18
After change some code in DemuxerBase.cs (attached file), it's better. Please review this change.
In this video you can see the video delay (of original code) when controlling the camera
Hi,
when snapshot current image from video stream, flyleaf control will flicker. Please see this video:
can you avoid this ?
Hi,
when play rtsp stream from camera, MediaRouter delay 15 seconds compare with VideoPlayer_HWAcceleration in Tutorials folder.
left is MediaRouter, right is VideoPlayer_HWAcceleration
this is rtsp url if you want to test: rtsp://admin:[email protected]:24554/Src/mediainput/stream_1
Hi,
can you help me get snapshot (as Bitmap or save to jpeg file) from video ?
Hi,
With 1 video: 3840x2160, 15 fps, duration 15 minute.
First time open this video: the memory consumption from 218 to 228 MB. After video finished, memory still 228 MB
Second time: memory increase from 228-> 239 MB,...
....
Hello, I would like to thank you for this awesome project, I've learned a lot from this!
I'm fairly new to FFmpeg programming, in the tutorial project, you are using Thread.Sleep()
to simulate video FPS. However I still don't understand how did you manage to display/present each frame in the correct time?
I'm aware there's pts
field in AVFrame
. But I have very little idea on how to use this properly. So my current attempt is by utilizing StopWatch
to present frame which is very ugly, CPU intensive and inaccurate.
// Wait until stopwatch reaches position
var position = frame.pts * av_q2d(stream.time_base) * 1000; // in ms
while (sw.ElapsedMilliseconds < position)
{
}
DisplayFrame();
Any assistance / explanation you can provide would be greatly appreciated!
Hi,
I want to play multi streams at same time so i am reading your sample to trying create a user control base on your frmControl.cs but not success.
Can you tell me the way to do this ?
If yes, can you add a method to get current frame (or save as jpeg file) from video/stream ?
Hi,
I dont know why but if you paste code below in any where of WinForms Sample (Basic),
FlyleafLib can not initiate:
code:
[StructLayout(LayoutKind.Explicit)]
public struct UNION_DVR_DETAIL
{
[FieldOffset(0)]
public STRUCT_DVR_PLATE dvrPlate;
[FieldOffset(0)]
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 128)]
public byte res;
}
[StructLayoutAttribute(LayoutKind.Sequential)]
public struct STRUCT_DVR_PLATE
{
[MarshalAs(UnmanagedType.ByValTStr, SizeConst = 16)]
public string plate;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 112)]
public byte[] res;
}
Seem there is an error here in LoadPlugins():
other recommend:
using Application.StartupPath instead of Environment.CurrentDirectory
baecause Environment.CurrentDirectory can change during execution.
Hello:
I have one MP4 format video (C:\Videos\1.mp4), which contains 1000 frames.
If I want to pick up frames every 100 frames, in my case, I want to pick up the first frame, the 100th, 200th, 300th, 400th, 500th, 600th, 700th, 800th, 900th and the last frame, and put them into one array of images.
Then use ImageMagick to find the image similarity between the first frame and other frames and find which is the first frame which is more than 10% different from the first frame.
One good example for this is the basketball score board, which will change after a few seconds or a few minutes, but there is no way to know when the score change will happen. In the worst case from my college experience, one women basket ball game ended with score: 4-0, it means it changes only twice (from 0-0 to 2-0, and from 2-0 to 4-0). But most other games will change very quickly.
Let me know if I can do this with your repo?
If yes, give me some code sample.
Thanks,
Hi there. I've searched around but i'm not finding anything about it: how you can select/change the resolution with youtube videos? Thank you!
Hi,
can i reduce decoding and rendering frame rate for lower CPU and GPU usage ?
ex: if frame rate of video source is 30 fps, im only need decode and display at 10, 15 fps, other frames will discard.
on my old PC (core i5 2400, AMD Radeon R7 200), for display rtsp stream from IP camera, it take ~50 % GPU:
Describe the bug
When playing a video and switching to/from a bluetooth device, the player stops playing the video and the application hangs.
To Reproduce
Steps to reproduce the behavior:
Expected behavior
The player doesn't freeze and the audio is transferred to or from the bluetooth audio device.
Additional context
I have determined the issue is most likely caused by this line:
Flyleaf/FlyleafLib/MediaPlayer/AudioPlayer.cs
Line 131 in 05c307b
lock
around it, which seems to sometimes fix the issue when connecting the bluetooth device, but never when disconnecting. I have also looked on the internet and there it is also suggested this might be a threading/deadlock issue, so the solution should probably be searched for in that area.
I will do some investigation myself to see if I can fix this issue, but if anyone has any ideas let me know.
Hello:
I have one video file (C:\Videos\1.mp4), which has duration of 3 minutes. I want to start play the video from 1 minute, so the total play time will be 2 minute.
Let me know how I can use your repo to do this? I mean I skip the first 1 minute video in the mp4 file?
Thanks,
Audio.SetDelayTicks function doesn't use the 'delay' parameter and sets the delay to 0.
I have done the following in order to use your repo in C# WinForm project (target .NET 5.0)
Download and unzip ffmpeg full build file from this URL:
https://www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7z
Copy the unzipped folder to C:\Program Files
Edit System PATH variable to add ffmpeg binary path.
Also copy the lib (all the *.DLL), and change project file to use the following target item:
net5.0-windows
I have installed nuget packages:
PM> Install-Package FFmpeg.AutoGen -Version 4.4.0
PM> Install-Package NAudio.Wasapi -Version 2.0.0
PM> Install-Package SharpDX.Mathematics -Version 4.2.0
PM> Install-Package FlyleafLib -Version 3.1.14
PM> Install-Package FlyleafLib.Controls.WPF -Version 1.1.4
Then in Form1 designer, open toolbox, and drag one Flyleaf (Flyleaflib.controls) to the Form1 designer.
The following is the code from Form1.designer.cs:
namespace FlyleafPlayerForm
{
partial class Form1
{
///
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.flyleaf1 = new FlyleafLib.Controls.Flyleaf();
this.SuspendLayout();
//
// flyleaf1
//
this.flyleaf1.BackColor = System.Drawing.Color.Black;
this.flyleaf1.Location = new System.Drawing.Point(28, 12);
this.flyleaf1.Name = "flyleaf1";
this.flyleaf1.Size = new System.Drawing.Size(760, 465);
this.flyleaf1.TabIndex = 0;
//
// Form1
//
this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(800, 503);
this.Controls.Add(this.flyleaf1);
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
this.ResumeLayout(false);
}
#endregion
private FlyleafLib.Controls.Flyleaf flyleaf1;
}
}
The following is the C# code for Form1.cs:
using FlyleafLib;
using System;
using System.Windows.Forms;
using FlyleafLib.MediaPlayer;
namespace FlyleafPlayerForm
{
public partial class Form1 : Form
{
public const string FFMPEG_Binary = @"C:\Program Files\ffmpeg-4.4-full_build\bin";
public const string Video_File1 = @"C:\Videos\1.mp4";
private static Player player1;
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
Master.RegisterFFmpeg(FFMPEG_Binary);
Config config = new();
config.demuxer.VideoFormatOpt.Add("probesize", (50 * (long)1024 * 1024).ToString());
config.demuxer.VideoFormatOpt.Add("analyzeduration", (10 * (long)1000 * 1000).ToString());
player1 = new Player(config)
{
Control = flyleaf1
};
player1.Open(Video_File1);
player1.Play();
}
}
}
I can compile my code, but when I run it, I saw only the black screen on the player, I can’t see any video file is being played.
Let me know if I made any mistake.
However, I can’t use WPF project, as there are many restrictions, one of which is difficult to use SQL server database, but I have to use SQL server database, as all the video file locations are stored in the database.
Please advise,
Thanks,
Hi,
On some PCs, application will crash at:
videoDevice1 = device.QueryInterface();
videoContext1 = device.ImmediateContext.QueryInterface();
you can change to:
videoDevice1 = device.QueryInterfaceOrNull();
videoContext1 = device.ImmediateContext.QueryInterfaceOrNull();
and check:
if (videoDevice1 != null)
{
videoDevice1.CreateVideoProcessorEnumerator(ref vpcd, out vpe);
videoDevice1.CreateVideoProcessor(vpe, 0, out videoProcessor);
}
if (videoDevice1 != null)
videoDevice1.CreateVideoProcessorOutputView((Resource)textureRGB, vpe, vpovd, out vpov);
or only create videoDevice1 on HW Decoding mode.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.