Serve video files

678 views
Skip to first unread message

Andrew

unread,
Apr 21, 2015, 7:36:16 PM4/21/15
to golan...@googlegroups.com
I want to use VideoJS to play .mp4 videos(very large files) from my website. How can I serve these video files effectively from Go web server?

Thanks.
Andrew

andrewc...@gmail.com

unread,
Apr 22, 2015, 12:35:20 AM4/22/15
to golan...@googlegroups.com

Andrew

unread,
Apr 24, 2015, 9:17:40 PM4/24/15
to golan...@googlegroups.com

Thanks for the reply. I tried this using a video tag:
<video width="320" height="240" controls>
  <source src="http://localhost:8080/video/movie.mp4" type="video/mp4">
</video>
It works if the video is very short. but it'll fail if the video is bigger. I think it works if the file can be copied within seconds.

Is there anyone know how to serve large files like youtube does?

Thanks.

jwoo...@gmail.com

unread,
Apr 26, 2015, 2:15:31 AM4/26/15
to golan...@googlegroups.com
You would probably want to STREAM the big media file.

It seems like youtube is using the DASH protocol for its HTML5 video player and probably RTMP for flash-based player (it might've been changed).

Piers

unread,
Apr 26, 2015, 3:50:34 AM4/26/15
to golan...@googlegroups.com
What might help (you) is to define "works" and "fail" more precisely - in doing so, some answers might present themselves. 

What exactly fails? Is there any difference between pressing play and waiting till the end, versus trying to randomly seek to different parts of the video?

And it's be useful to consider if the OS, Browser, video plugin (if any) which consumes the stream has any influence on the outcome. Does the behaviour change if the browser is not on the same machine as the server? With a different player other than VideoJS? Can you run curl or wget on the video URI without any problems?

If you invoke your browser's debug mode can you observe the network behaviour when things go wrong?

Also, can you find through experiment the exact length (in seconds, and/or in bytes) where it goes from ok to not ok? Which leads to a final variable, what is/are the bit-rates of the video files? Do different bit rate files change the outcomes?

I'm not saying with these answers that I (or anyone) will be able to provide a solution, but just performing the experiments yourself might lead to some eureka moment, or, pinpoint much more precisely a genuine bug somewhere.

Andrew

unread,
May 26, 2015, 1:33:33 AM5/26/15
to golan...@googlegroups.com

Thanks all for the reply. Actually I run this in appengine development server (using "goapp serve" command). It shows nothing in windows 7 but just failed silently(although it does show error in Chrome console). When I run this program in Ubuntu, it shows "Response too large: 909686291, max is 33554432" error message.

If I run it as a standalone  program, the video file can be played without any problem. So I think the file size limit is just for appengine environment.

DhilipKumar Sankaranarayanan

unread,
May 26, 2015, 1:47:59 AM5/26/15
to golan...@googlegroups.com
For streaming very large video files (>1GB) i have used.  

func ServeContent

This helps a lot while the user seeks the video based on time slice.  ServeContent basically serves range http request. 

Andrew

unread,
May 28, 2015, 5:16:51 PM5/28/15
to golan...@googlegroups.com
Wow, I think this is the answer. But I can't find a good example about how to use this function. 

Can you please show me how to use this function to serve videos to the client? or the link to some open source project.

Thanks.

Matt Harden

unread,
May 29, 2015, 9:58:20 AM5/29/15
to Andrew, golan...@googlegroups.com
http.FileServer uses this function behind the scenes. See the example under http://godoc.org/net/http#FileServer. Since you said you already tried this, I guess that's not going to solve your problem.

--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Benjamin Measures

unread,
May 29, 2015, 5:48:39 PM5/29/15
to golan...@googlegroups.com
On Tuesday, 26 May 2015 06:33:33 UTC+1, Andrew wrote:
Actually I run this in appengine development server (using "goapp serve" command) [...] it shows "Response too large: 909686291, max is 33554432" error message.

If I run it as a standalone  program, the video file can be played without any problem. So I think the file size limit is just for appengine environment.

Reply all
Reply to author
Forward
0 new messages