Closed zydjohnHotmail closed 3 years ago
Your Url input will be parsed by the demuxer (ffmpeg). Which means that ffmpeg is responsible to process your requests through a proxy. If you check ffmpeg protocols you will see that you can give an http_proxy FormatOpt to it.
Config.demuxer.FormatOpt.Add("http_proxy","http://myproxy/");
Hello:
Thanks for your reply, I tried the following code in the wrapper class.
using FlyleafLib; using FlyleafLib.MediaFramework.MediaContext; using System.Diagnostics;
namespace FlyDownloader325UKProxy1 { public class DownloaderProxy1 { public static Downloader FlyleafHLSDownloader(int uniq_id, string url1, string video_file1) { Config.Demuxer proxy_demuxer = new (); proxy_demuxer.FormatOpt.Add("http_proxy", "http://1.2.3.4:5678"); Downloader proxy_downloader1 = new(proxy_demuxer, uniq_id); if (proxy_downloader1.Open(url1) != 0) { Debug.Print("Could not open url input"); return null; } proxy_downloader1.Demuxer.EnableStream(proxy_downloader1.Demuxer.VideoStreams[0]); if (proxy_downloader1.Demuxer.AudioStreams.Count != 0) proxy_downloader1.Demuxer.EnableStream(proxy_downloader1.Demuxer.AudioStreams[0]); proxy_downloader1.Download(ref video_file1, true); return proxy_downloader1; } } }
I have some paid proxy service, and I have one fixed IP address, and my proxy server can authenticate by IP address, so I don’t have to provide user name and password. From above code: 1.2.3.4 is the IP address of my proxy server, and 5678 is the port number on the proxy serve. However, I didn’t know what is the correct format to provide proxy settings in Demuxer. After my testing, I still found that the quality of M3U8 video downloaded in my local disk is very bad. It seems the proxy setting didn’t work. Please advise on how to provide proxy parameter for Demuxer. Thanks,
So the proxy worked? You might need to pass cookies/headers. Have you checked all the available streams that you have to ensure that you choose the best quality?
Hello: I don't think the proxy works, as the quality of video is very bad. I can find only one M3U8 link for live sports video. As it is not easy, I have to use Playwright to login to web site, and visit each live sports game, then intercept all http requests, as long as I found the M3U8 link, I can use Flyleaf downloader to download video from the M3U8 link. I can give you a few links, you can test to see if you can download with proxy or without. From my testing, the video quality is very bad with either proxy or without. But from the UK based proxy Google Chrome, the embed video from the web page is rather good. I can show you one image of downloaded video, which is bad.
Hello: There is one M3U8 link I can get from the UK based web site: https://dice-gaming-live-eu.akamaized.net/hls/live/2000091/198543-198801/exchange198543GinDt_198543_412/exp=1630145676~acl=%2f*~id=37dd210a-8757-4a69-bb3e-c9817d5e6552~data=hdntl~hmac=f07463baa9b5ac35080c5c93876999079bd762effff685b733cf7e0c290aebb7/chunklist.m3u8 You can take a look!
Just set the user agent to pretent it's a browser
config.Demuxer.FormatOpt.Add("user_agent","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.159 Safari/537.36");
Edit: That was my problem only? Yes the quality it's pretty bad, but I can't do anything about it
Hello: I modified my code, so it looks like this: using FlyleafLib; using FlyleafLib.MediaFramework.MediaContext; using System.Diagnostics;
namespace FlyDownloader325UKProxy1 { public class DownloaderProxy1 { public const string Chrome_User_Agent = @"Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/86.0.4240.111 Safari/537.36";
public static Downloader FlyleafHLSDownloader(int uniq_id, string url1, string video_file1)
{
Config.Demuxer proxy_demuxer = new ();
proxy_demuxer.FormatOpt.Add("http_proxy", "http://1.2.3.4:5678");
proxy_demuxer.FormatOpt.Add("user_agent", Chrome_User_Agent);
Downloader proxy_downloader1 = new(proxy_demuxer, uniq_id);
if (proxy_downloader1.Open(url1) != 0)
{
Debug.Print("Could not open url input");
return null;
}
proxy_downloader1.Demuxer.EnableStream(proxy_downloader1.Demuxer.VideoStreams[0]);
if (proxy_downloader1.Demuxer.AudioStreams.Count != 0)
proxy_downloader1.Demuxer.EnableStream(proxy_downloader1.Demuxer.AudioStreams[0]);
proxy_downloader1.Download(ref video_file1, true);
return proxy_downloader1;
}
}
}
After I run the new code, the result is almost the same. The quality of video is very bad. Any more advices?
Hello: I have an account with one web site, which I can view some sports videos. But due to the area restrictions, I have to use a proxy based in UK. From my testing, if I setup global proxy for my PC, then I can login to the web site by hand, and use a M3U8 download chrome extension, I can view M3U8 feed by using VLC player, the quality of video is OK. But when I used Flyleaflib to download M3U8 feed and save to local disk, the quality of video is terrible, almost impossible to view it. I want to know how I can fix the proxy issue in FlyleafLib? I tried both using global proxy, and without any proxy, the results are the same. The video quality is too bad to view. But for another web site, which I can access from my current location without UK based proxy, download M3U8 feed, the quality of video is good. Any suggestions? I have the following FlyleafLib version 3.2.5 wrapper class: using FlyleafLib; using FlyleafLib.MediaFramework.MediaContext; using System.Diagnostics;
namespace FlyleafDownloader325 { public class FLDownloader { public static Downloader FlyleafHLSDownloader(int uniq_id, string url1, string video_file1) { Downloader Downloader1 = new(new Config.Demuxer() { MaxQueueSize = 1000 }, uniq_id); if (Downloader1.Open(url1) != 0) { Debug.Print("Could not open url input"); return null; } Downloader1.Demuxer.EnableStream(Downloader1.Demuxer.VideoStreams[0]); if (Downloader1.Demuxer.AudioStreams.Count != 0) Downloader1.Demuxer.EnableStream(Downloader1.Demuxer.AudioStreams[0]); Downloader1.Download(ref video_file1, true); return Downloader1; } } }
The following is the C# code to call this wrapper class: Downloader load_hls1 = FlyleafDownloader325.FLDownloader.FlyleafHLSDownloader(10, hls_url1, mp4_local_file1); I can provide some URLs in about 20 hours from now. You can test anywhere in the world, but if you are not in UK, then most likely the downloaded MP4 video will be in rather bad quality. Thanks,