XFileSharing Pro - problem with flv and mp4 video seeking jwplayer + nginx

Message
Author
zzzxc12
Posts: 8
Joined: Jul 28, 2012 5:45 pm

problem with flv and mp4 video seeking jwplayer + nginx

#1 Postby zzzxc12 » Aug 12, 2012 4:31 pm

problem with flv and mp4 video seeking jwplayer + nginx

i am trying to enable video seeking.
i am using xfs version 1.9

let me tell you what i did:

first, i changed in index.cgi

Code: Select all

s1.addVariable('provider','video');

to this

Code: Select all

s1.addVariable('provider','http');


---------------------------------------------------------

after that i tried to configure nginx.

config 1 :

Code: Select all

 ./configure --with-http_stub_status_module --with-http_perl_module --with-http_flv_module --with-http_mp4_module

and also tried the h264 streaming module:

Code: Select all

./configure --add-module=/root/nginx_mod_h264_streaming-2.2.7 --sbin-path=/usr/local/sbin --with-debug --with-http_stub_status_module --with-http_perl_module --with-http_flv_module --with-http_mp4_module ; make && make install

*also tried without the mp4_module
--------------------------------------------------------

nginx conf file:

this is where i am having trouble...

i tried to add flv; and/or mp4; inside location d

Code: Select all

       location /d/ {
            perl  download::handler;
        }
 

than tried to add it here, for every type of user where the XXX are.

Code: Select all

        # Free
        location /download1_f/ {
            alias /var/www/cgi-bin/uploads/;
XXX
            internal;
            set $limit_rate $arg_speed;
            limit_conn one 2;
            access_log  logs/traffic.log  xfs;
        }

        # Registered
        location /download1_r/ {
         .....
        }

        # Premium
        location /download1_p/ {
         ......
        }
 



but..................
on both of the locations - when i do that i get all sorts of errors, from seeking not working to "video not found" to 500 internal error when trying to watch flv files .

it looks like when the mp4 seeking is working than the flv files has problems and vice versa

in addition i installed yamdi and flvtools2

anyone knows how to fix the seeking?
admin can you help?

PowerChaos
Posts: 521
Joined: Dec 19, 2009 5:12 pm

#2 Postby PowerChaos » Aug 12, 2012 6:29 pm

1 simple reason for this

FLV does not support seeking
only mp4 does support it

to explain that part simple

mp4 contains differend data that thells where to start streaming from ( like a torrent) if encoded right

you need to see it like a rar archive
if you make a rar archive solid , then you need to extract all files before you can open a single file

if you do not make the rar file solid , then you can take out a file in the middle of the rar file

flv works the same way , if the flv is not converted to contain those "keys" then it wont work

mp4 in general contains those keys so they will work ( most of them , not all )

mp4 wrote:Note that the start and end times are always aligned to the nearest keyframe. The more keyframes you have in your video the more accurate it will be. In FFMPEG you can set the number of keyframes with the 'Set group of pictures size' (-g gop_size) option.


Greetings From PowerChaos

zzzxc12
Posts: 8
Joined: Jul 28, 2012 5:45 pm

#3 Postby zzzxc12 » Aug 12, 2012 6:40 pm

didn't know that :)

so where would you put the directives flv; and mp4; ?
(is there a need for flv; ? )

when i add mp4; seeking works for the mp4 videos but for flv videos it says on the jwplayer "not found ......"

thanks for your reply!

PowerChaos
Posts: 521
Joined: Dec 19, 2009 5:12 pm

#4 Postby PowerChaos » Aug 12, 2012 6:52 pm

what you exactly mean ??

directive for flv ?

you just install the pseudostream code , use the following code to get the mp4 psuedostreaming working ( apache 2 )

Code: Select all

s1.addVariable('provider','http');
s1.addVariable('http.startparam','start');
s1.addVariable('streamer','$file->{direct_link}');

and you can player mp4 and flv files

but only seeking works for the mp4 files or do you encode the flv files on your own with the keys in it ??

i do not know why your player would say "not found" or you messsed up the script that it can not create a dynamic link anymore

at top of the script you should see this kind of code

Code: Select all

elsif($file->{vid_codec}=~/(flv|h264)/i && $file->{file_name}=~/\.(mp4)$/i)
      {
         $file->{direct_link} = DownloadGenLink($file,'video.mp4');

that means that your file will always be video.mp4 or any other name you provide

i use version 1.8 so it can be a bit differend for you , but basicly it stays the same (v2 looks a bit differend but still the same , some commands are just a little differend)

if that part is missing for the flv files .. then you indeed get the error of video not found

Greetings From PowerChaos

zzzxc12
Posts: 8
Joined: Jul 28, 2012 5:45 pm

#5 Postby zzzxc12 » Aug 12, 2012 8:48 pm

hi

i will explain better...

before, i had only s1.addVariable('provider','http');
now i have :
s1.addVariable('provider','http');
s1.addVariable('http.startparam','start');
s1.addVariable('streamer','$file->{direct_link}');

i can watch flv and mp4 - no problem ...

the problem is when i want to seek, to jump to other time in the video.

when i seek \ jump to 10:34 , the video is buffering and than starts from the beginning of the video 0:00 and not from 10:34, although in the progress bar shows it is 10:34 . (but really the video starts again from 0)


so i thought i should add

Code: Select all

mp4;

to nginx, right?



when i added mp4; to the conf file
the seeking worked but i wasn't able to watch flv files
and than i have a "not found" error for flv videos,
when i remove the mp4; directive from nginx conf file
i can watch mp4 and flv but no seeking for mp4
so weird...
Last edited by zzzxc12 on Aug 12, 2012 9:03 pm, edited 1 time in total.

PowerChaos
Posts: 521
Joined: Dec 19, 2009 5:12 pm

#6 Postby PowerChaos » Aug 12, 2012 9:01 pm

i got no idea about nginx , i use apache

but that the video start back on 0 means that it does not find the key or that it can not load the key ( thats where that h264 mod is for )

on apache it is useless to try it for flv files , as they can not be fast skipped

but the mp4 files works with the code i provided

if i am not wrong , nginx does not need any kind of mod to support the seeking option (or was that lighttpd )

eather way , you could try to add that part to the config so it reconise the mp4 files and get handled by the mod
you also could add the flv extention to it so it looks like the following command (in apache atleast)

Code: Select all

AddHandler h264-streaming.extensions .mp4
AddHandler h264-streaming.extensions .flv


for nginx it should look like this ( taken from the site )

Code: Select all

location ~ \.mp4$ {
  mp4;
}
location ~ \.flv$ {
  mp4;
}


then probaly both files will work , but the flv need to be h264 coded to to be able to work

this is the info i got from wikipedia
http://en.wikipedia.org/wiki/Flash_Video

Code: Select all

Supported media types in FLV file format:[1]
Video: On2 VP6, Sorenson Spark (Sorenson H.263), Screen video, H.264
Audio: MP3, ADPCM, Linear PCM, Nellymoser, Speex, AAC, G.711 (reserved for internal use)


Greetings From PowerChaos

zzzxc12
Posts: 8
Joined: Jul 28, 2012 5:45 pm

#7 Postby zzzxc12 » Aug 12, 2012 9:19 pm

i already tried what you said but i aget the same problem with the video not found... i think i will take a break and have a fresh start tomorrow

btw - flv videos are seek-able....
when you use nginx it sends the meta details first and than the video so you can seek,
if someone wants to do it too you can achieve it by adding
"flv; " to every type of user in nginx conf file

like so :

Code: Select all


        # Free
        location /download3_f/ {
            alias /var/www/cgi-bin/uploads/;
            internal;
        flv;
            set $limit_rate $arg_speed;
            limit_conn one 2;
            access_log  logs/traffic.log  xfs;
        }

        # Registered
        location /download3_r/ {
            alias /var/www/cgi-bin/uploads/;
            internal;
        flv;
            set $limit_rate $arg_speed;
            limit_conn one 2;
            access_log  logs/traffic.log  xfs;
        }

        # Premium
        location /download3_p/ {
        alias /var/www/cgi-bin/uploads/;
            internal;
        flv;
            set $limit_rate $arg_speed;
            limit_conn one 10;
            access_log  logs/traffic.log  xfs;
        }

PowerChaos
Posts: 521
Joined: Dec 19, 2009 5:12 pm

#8 Postby PowerChaos » Aug 12, 2012 9:40 pm

on apache it is still not posible to seek flv

but why using flv if it is the time of mp4 files


here is a good example

http://www.boosterking.com/x0cqn6npjz7k ... 9.flv.html
thats a flv file , you can skip only after file is complete loaded

http://www.boosterking.com/5i0q95zqkv4s ... v.mp4.html
same file , converted to mp4 and seeking is avaible

a small sidenote
it seems that html5 does not need to have psuedostreaming at all , it support the seek function (tested on a server with html5 player and no psuedostreaming + apache 2.2x )
but not all browsers support html5 (most browsers does)

the easy'st solution is probaly to just use a html5 player and forget about flv player as there are almost no users who upload flv files :D

Greetings From PowerChaos

zzzxc12
Posts: 8
Joined: Jul 28, 2012 5:45 pm

#9 Postby zzzxc12 » Aug 13, 2012 2:28 pm

you're right about the html5 player

i checked your links but for the flv file, seeking doesn't work even after the file finished loading.
it doesnt matter "when" you click it always start from 0:00

and for the second file seeking is not working too
when its with the jwplayer - no seeking at all
when its with the divx web player - you can seek only on the loaded parts

PowerChaos
Posts: 521
Joined: Dec 19, 2009 5:12 pm

#10 Postby PowerChaos » Aug 13, 2012 3:00 pm

maybe you dit something wrong
if i do a test then it runs fine

but it does indeed not work on internet explorer , only for firefox/google chrome

i do not know why , but probaly it has to do with the way internet explorer loads the flashfile or because of the params that get used ( that it does not understand the streaming param or so ?)

eather way , it does work for google chrome and firefox and it is the h264 mod that get used :D

Greetings From PowerChaos


Return to “XFileSharing Pro”