Comments (6)
Hopefully, I will find sometime to write a documentation soon. Until then, I have some samples to help you out with the basic implementations. For the downloader, I have this one https://github.com/SuRGeoNix/Flyleaf/blob/master/Wpf%20Samples/Sample4_Downloader.xaml.cs
Did you have a look and you still need some help?
from flyleaf.
Hello:
Thank you very much for your reply.
I have some concerns: first, I don't know how to call this partical class, do you have the code sample for the caller?
second, I don't like to use WPF, which has many restrictions, can I use the class in either C# console project or C# WindForm project?
finally, I see your code:
public DemuxerBase Downloader { get; set; } = new VideoDemuxer(new Config(), 777);
I want to know what the number 777 means.
In my case, I have to download multiple M3U8 live streaming URLs at the same time. For example, I have 2 Olympic games are on going at the same time.
Can I use one client with Config() ID# 777, and another client with Config() ID# 888?
In short, I want to initalize the class instance from the caller with different Config() ID#, and different M3U8 URL.
Can this be done in C# console or WinForm project?
Finally, the download percentage can NOT decided for real live streaming URL.
I give you one of such URL, it will expire in a few hours from now.
https://video1.maxline.by:444/o1/stream04/chunks.m3u8?nimblesessionid=3025892
Can you show me the code on how to reach my target?
Thanks,
from flyleaf.
Hey @zydjohnHotmail
To use the solution right click on Wpf Samples project and select "Set as Startup Project". Then edit App.xaml and set the StartupUri to Sample4_Downloader.xaml. That's all.
Now, the code that you ask is already inside that project, the library code can be used from any project that you reference (winforms/wpf/consoles).
Basic steps to use the library for this purpose:
- Register FFmpeg libraries
Master.RegisterFFmpeg(@"c:\ffmpeg\x64");
- Create the Demuxer/Downloader classes (yes for each you need a unique id until I will decide what to do with it)
DemuxerBase Downloader = new VideoDemuxer(new Config(), 1);
- Register to event
Downloader.DownloadCompleted += Downloader_DownloadCompleted;
- Open input url
if (Downloader.Open(url) != 0) { MessageBox.Show("Could not open url input"); return; }
- Select the audio/video streams that you want to download (validate that they exist and what quality you want)
Downloader.EnableStream(Downloader.VideoStreams[0]);
if (Downloader.AudioStreams.Count != 0) Downloader.EnableStream(Downloader.AudioStreams[0]);
- Start the downloader
Downloader.Download(System.IO.Path.Combine(System.IO.Path.GetTempPath(), $"testVideo{downloadCounter++}.mp4"));
- Catch the complete event
private void Downloader_DownloadCompleted(object sender, bool success)
{
if (success)
{
if (Downloader.DownloadPercentage == 100)
MessageBox.Show("Download Completed!");
else
MessageBox.Show("Partial/Live Download Completed!");
}
else
MessageBox.Show("Download Failed!");
}
If you have a live stream of course there is no Downloader.DownloadPercentage. You decide when to manually stop with Downloader.Stop();
You can also use Record on demand while watching (ctrl+R for the demo version if you want to tested). The advantage is that you record the streams that you have selected from the player.
from flyleaf.
Hello:
Thank you very much for your kind help.
I tried to follow your advice, and I can download fixed size video. But for the live streaming video, I see that the program download only first 30 seconds, then it stops. I don't know how to fix this.
You can try this URL:
https://video1.maxline.by:444/o1/stream30/chunks.m3u8?nimblesessionid=3027958
But it will expire in a few hours.
Thanks,
from flyleaf.
You are right, I'm looking at it.
Edit: Yes it's a bug with the new version and the new timeouts...
from flyleaf.
It should be fixed now. Have a look and let me know if not. You might also want to check the timeouts/options/flags etc. for more advanced things.. see Demuxer's Config, FFmpeg's protocols, FFmpeg's formats
eg. you might need to use this for live streams:
config.demuxer.VideoFormatOpt.Add("reconnect_at_eof", "1");
from flyleaf.
Related Issues (20)
- Issues of brightness control HOT 1
- [New feature requests]Added multi-threading support for M3U8 HOT 3
- Demuxer: Blu-Ray Support HOT 8
- Subtitles seeking support HOT 2
- Memory Leakage HOT 11
- current subtitle disappear when resuming from pause HOT 1
- WPF FlyleafHost: Load/Unload should be symmetrical HOT 1
- Deadlock in Pause() HOT 3
- how to config automatically reconnect
- Audio stopped after some time in rtsp stream HOT 1
- Settings Dialog and Popup Menu Not Show in flwpf:FlyleafME HOT 3
- Memory Leak when ZeroCopy = False HOT 8
- To play i frames only in a video HOT 2
- Can Multiple Audio Streams in One File Be Played Simultaneously? HOT 2
- RTSP Tcp option Not work HOT 2
- Current subtitle is not displayed after seeking HOT 5
- A way to work with alpha video(WPF)
- question about playing pictures HOT 1
- For WPF project, adds an editable playlist control that can import Windows Media Player playlists file, supporting sequential playback and loop playback
- Remove Speed Limitation for Reverse Playback HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flyleaf.