RenderHeads / UnityPlugin-AVProVideo

AVPro Video is a multi-platform Unity plugin for advanced video playback
https://www.renderheads.com/products/avpro-video/
231 stars 28 forks source link

Video Time Not Showing Right When Playing Via URL #78

Closed CoolKid404 closed 4 years ago

CoolKid404 commented 5 years ago

I keep having an issue when inputting a link from a non-local URL (I am generating links from Youtube videos that are converted to stream into AVPro Video), the plugin has the time incorrect, usually indicating the video is only a few seconds long.

Though it plays fine past the video length indicated in the inspector, it causes major instability when trying to seek, often times causing the editor to crash. It seems the only work around I can find at the moment is re-loading the video URL in AvPro over and over until the video time is correct.

Setup

To Reproduce

  1. Extract video from Youtube Link (would be easiest to test with something like Youtube-dl)
  2. Take URL from above and put it into AVPro VIdeo Source Path (Absolute Path or URL)
  3. Load said URL, look at Time Bar shown below video preview in Inspector, same video length is also shown when calling "avProPlayer.Info.GetDurationMS()"

Screenshots If applicable, add screenshots to help explain your problem. TimeIssue

AndrewRH commented 5 years ago

Hi Robert,

Thanks for getting in touch.

We don't officially support YouTube streams, but I can try to offer some advice.

First of all, I wonder if it is just the editor component that is showing a cached duration, and actually if the duration is queried it will return the correct value?

So for example, if you attach a DebugOverlay component to your scene, it should show a preview of the video properties in the top-left corner of your screen - is the duration correct in that case?

CoolKid404 commented 5 years ago

Hi Andrew,

Thanks for the quick reply! I just finished testing it with the DebugOverlay script, unfortunately the issue persists. I'll attach another gif of what it looks like for you. DebugOverlayExample

AndrewRH commented 5 years ago

Thanks! Out of interest - why are you using the DirectShow API?
DirectShow behaviour will be inconsistent and depend on which 3rd party codecs you have installed.. What happens if you switch to Media Foundation API?

CoolKid404 commented 5 years ago

One of the primary reasons we went ahead with purchasing AVPro was its DirectShow support. A lot of the testing we do is with Windows 7, and it seems there is some resolution limitations using Windows Media Foundation on Windows 7. Using DirectShow seems to have caused all those limitations to no longer be an issue.

This Error Is Not in AVPro, But Will Show With a 1080p+ Video Using Unity's Built In Video Player Component (Just Showing For Example):

WindowsVideoMedia error 0x80070057 while reading (Video URL Here) Context: MFCreateSourceReaderFromURL Error details: The parameter is incorrect.

On my system running Windows 10, trying the same link using shown in the previous gifs throws this error when using Media Foundation.

[AVProVideo] Error: Loading failed. File not found, codec not supported, video resolution too high or insufficient system resources. UnityEngine.Debug:LogError(Object) RenderHeads.Media.AVProVideo.MediaPlayer:UpdateErrors() (at Assets/AVProVideo/Scripts/Components/MediaPlayer.cs:1740) RenderHeads.Media.AVProVideo.MediaPlayer:Update() (at ?Assets/AVProVideo/Scripts/Components/MediaPlayer.cs:1105)

But the same video will play fine using DirectShow (minus this issue with showing the video duration). For clarity I will another gif on this message so you can see a demonstration.

Thanks for your continued help on this. WMF Vs DirectShow

AndrewRH commented 5 years ago

Interesting!

Well I see that internally we are caching the duration in our DirectShow player, so it's only read once at the start. I can try not caching it to see if that solves it. It may be that the duration increases as more of the video is downloaded. Is there a way I can get the URL you are using for testing? I presume the URL expires after a short time?

Thanks,

CoolKid404 commented 5 years ago

I see, but I can try to provide it but they do expire some time after generating them.

Youtube Link: https://www.youtube.com/watch?v=LXb3EKWsInQ

Direct Link: https://r6---sn-8xgp1vo-2ial.googlevideo.com/videoplayback?id=o-APLCa6sjNxW3lA0V1RGhzL4M_ivCRNBRVIYY8KPIfU4X&aitags=133,134,135,136,137,160,242,243,244,247,248,271,278,298,299,302,303,308,313,315,330,331,332,333,334,335,336,337,394,395,396,397,398,399,400,401&itag=313&source=youtube&requiressl=yes&mm=31,29&mn=sn-8xgp1vo-2ial,sn-ab5l6n6s&ms=au,rdu&mv=m&pl=16&ei=aFT6XLWTMauKhwbvzjQ&initcwndbps=1655000&mime=video/webm&gir=yes&clen=665230337&dur=313.780&lmt=1556997736652045&mt=1559909429&fvip=6&keepalive=yes&beids=9466585&c=WEB&txp=5532232&ip=100.19.133.15&ipbits=0&expire=1559931081&sparams=ip,ipbits,expire,id,aitags,source,requiressl,mm,mn,ms,mv,pl,ei,initcwndbps,mime,gir,clen,dur,lmt&signature=D9BD9A28ABDBDE5177F8513A3A86A26CD698E2E9.DC0B75C1C3E36213143B72EEE838AEBBE047E60F&key=yt8&ratebypass=yes

If that link expires by the time you see this here is a way you can generate one yourself:

  1. ) Get This Tool: https://ytdl-org.github.io/youtube-dl/index.html 2.) Using the Command Prompt do the following (Assuming file is on desktop) 3.) Type (Without Quotes)

4.) Two links should be printed, one with audio, one with video. Top link is usually the video link, 5.) You can then just fill that link into AVPro, and the video should play

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

AndrewRH commented 4 years ago

This should be fixed now in version 2.0 which will be released in a near future. Thanks again for reporting this issue.