Re: [squid-users] anyone knows some info about youtube "range" parameter?

From: johan firdianto <johanfirdi_at_gmail.com>
Date: Fri, 27 Apr 2012 22:46:22 +0700

Stripping range work for me, now i can save the whole video.
disadvantage of saving chunk file, same video could have some chunks.
right now we could save 1.7M chunk file, nexti time youtube change
range paremeter to 2.3M,
it will download the same video again with different size.

disadvantage of saving the whole video, if the user want to jump to
the end of video, should wait the flash player finish download.
the life is choose.

On Thu, Apr 26, 2012 at 3:39 PM, Christian Loth
<c.loth_at_phase2-networks.com> wrote:
> Hello,
>
> On Thursday 26 April 2012 10:15:33 johan firdianto wrote:
>> This range behaviour related with error occured in youtube flash player ?
>> i'm using url rewrite if any range parameter in uri videos, i stripp off.
>> i can save the whole file of video to directory, by parsing store.log
>> and retrieve the same video using curl/wget.
>> The problem, when the same video is requested, and my rewrite script
>> issues 302  to the file that directory located (under web directory
>> using nginx).
>> error occured message appears in flash player.
>> I refresh many times, still error occured, unless i choose different
>> quality (example: 480p or 240p).
>> any suggest ?
>
> Errors during video playback were the reason I had to do research about range
> in the first place. Simply accepting the range-parameter didn't work for
> obvious reasons: because the cached object was constantly overwritten by
> subsequent chunks.
>
> Stripping the range-parameter didn't work well either for me, because
> youtube's flash player expected a chunk but got the whole file. This also
> resulted in an error for me.
>
> The only solution to work was adding the range-parameter to the filenames
> of the stored files as seen in my nginx configuration in my previous e-mail.
>
> And this solution works currently, and because the range-parameters are
> predictable with simple playback, we also experience a caching and thus
> bandwidth saving effect. Bandwidth saving is seen by two effects: a) serving
> a user from cache, and b) if a user interrupts video playback (clicking from
> one video to another) we only have downloaded a certain number of chunks
> and not the whole video.
>
> HTH,
> - Christian Loth
>
>
>>
>>
>> On Thu, Apr 26, 2012 at 2:41 PM, Christian Loth
>>
>> <c.loth_at_phase2-networks.com> wrote:
>> > Hi,
>> >
>> > On Thursday 26 April 2012 03:44:58 Eliezer Croitoru wrote:
>> >> as i already answered a detailed answer to Ghassan.
>> >> i think that caching the chunks if possible is pretty good thing.
>> >> i tried it with nginx but havnt got the option to try it with
>> >> store_url_rewrite.
>> >
>> > To maybe save you some work, here's how I did it. First of all, I use
>> > nginx as a cache-peer - so no URL rewriting script. Excerpt of my
>> > squid.conf:
>> >
>> >
>> > acl youtube_videos url_regex -i
>> > ^http://[^/]+(\.youtube\.com|\.googlevideo\.com|\.video\.google\.com)/(vi
>> >deoplayback|get_video|videodownload)\? acl range_request req_header Range
>> > .
>> > acl begin_param url_regex -i [?&]begin=
>> > acl id_param url_regex -i [?&]id=
>> > acl itag_param url_regex -i [?&]itag=
>> > acl sver3_param url_regex -i [?&]sver=3
>> > cache_peer 127.0.0.1 parent 8081 0 proxy-only no-query connect-timeout=5
>> > no-digest cache_peer_access 127.0.0.1 allow youtube_videos id_param
>> > itag_param sver3_param !begin_param !range_request cache_peer_access
>> > 127.0.0.1 deny all
>> >
>> > Small note: the range request in this configuration that is denied is the
>> > HTTP-Range-Header, not the range URL parameter! Nginx is of course
>> > running on port 8081 on the same server.
>> >
>> > The important configuration directive in nginx is as follows:
>> >
>> > server {
>> >        listen       127.0.0.1:8081;
>> >
>> >        location / {
>> >                root   /var/cache/proxy/nginx/files;
>> >                try_files
>> > "/id=$arg_id.itag=$arg_itag.range=$arg_range.algo=$arg_algorithm"
>> > @proxy_youtube; }
>> >
>> >        location @proxy_youtube {
>> >                resolver 134.99.128.2;
>> >                proxy_pass http://$host$request_uri;
>> >                proxy_temp_path "/var/cache/proxy/nginx/tmp";
>> >                proxy_ignore_client_abort off;
>> >                proxy_store
>> > "/var/cache/proxy/nginx/files/id=$arg_id.itag=$arg_itag.range=$arg_range.
>> >algo=$arg_algorithm"; proxy_set_header X-YouTube-Cache
>> > "c.loth_at_phase2-networks.com"; proxy_set_header Accept "video/*";
>> >                proxy_set_header User-Agent "YouTube Cache (nginx)";
>> >                proxy_set_header Accept-Encoding "";
>> >                proxy_set_header Accept-Language "";
>> >                proxy_set_header Accept-Charset "";
>> >                proxy_set_header Cache-Control "";
>> >        }
>> > }
>> >
>> > This way, the setup works. Perhaps anyone of you even has a piece of
>> > advice for improving it? E.g. I'm still looking for a way to log nginx
>> > proxy_store hits and misses...?
>> >
>> > Best regards,
>> > - Christian Loth
>>
Received on Fri Apr 27 2012 - 15:46:29 MDT

This archive was generated by hypermail 2.2.0 : Fri Apr 27 2012 - 12:00:04 MDT