modifying ffserver.

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

modifying ffserver.

Keean Schupke-2
Hello,

I am new to modifying the ffmpeg/ffserver code, but am an experienced
programer and have worked with codecs in the past (I designed a motion
compensation engine for a hardware mpeg2 encoder chip).

I am looking to modify ffserver, as I require the following features
for a project I am working on:

- have a static jpeg (logo) streamed when nothing else to stream
- stream each file uploaded to the feed once and in sequence

Imagine the server acting as a video juke-box, dislaying a logo whilst
nothing else is happening, and queueing the videos to play back in
sequence.

The output must be a continuous RTSP or HTTP stream with no bad
timecodes or anything that would upset a streaming client.

Is this possible with the architecture of ffserver?
Any ideas where to start, what sort of changes I am looking at and
where in the code the relavent bits may be?

Any help or advice greatly appreciated.

Regards,
Keean.
_______________________________________________
libav-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: modifying ffserver.

Luca Abeni
Hi Keean,

Keean Schupke wrote:
[...]
> I am looking to modify ffserver, as I require the following features
> for a project I am working on:
>
> - have a static jpeg (logo) streamed when nothing else to stream
> - stream each file uploaded to the feed once and in sequence
>
> Imagine the server acting as a video juke-box, dislaying a logo whilst
> nothing else is happening, and queueing the videos to play back in
> sequence.
[...]

In my understanding, performing this kind of operations in ffserver
might be too complex (and maybe this is not the correct approach).
I suppose it would be simpler to feed ffserver with an "already processed"
video stream, and to implement the features you need in the program which
feeds ffserver (maybe you can reuse ffmpeg, with some modifications).



                                Luca
_______________________________________________
libav-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: modifying ffserver.

Keean Schupke-2
On 11/06/2008, Luca Abeni <[hidden email]> wrote:

> Hi Keean,
>
>  Keean Schupke wrote:
>  [...]
>
> > I am looking to modify ffserver, as I require the following features
>  > for a project I am working on:
>  >
>  > - have a static jpeg (logo) streamed when nothing else to stream
>  > - stream each file uploaded to the feed once and in sequence
>  >
>  > Imagine the server acting as a video juke-box, dislaying a logo whilst
>  > nothing else is happening, and queueing the videos to play back in
>  > sequence.
>
> [...]
>
>  In my understanding, performing this kind of operations in ffserver
>  might be too complex (and maybe this is not the correct approach).
>  I suppose it would be simpler to feed ffserver with an "already processed"
>  video stream, and to implement the features you need in the program which
>  feeds ffserver (maybe you can reuse ffmpeg, with some modifications).
>
>
>
>                                 Luca
>  _______________________________________________

Hi Luca,

Okay, I was thinking that each clip would be sequenced into ffserver
using ffmpeg like:

ffmpeg -i video1.avi http://localhost:8090/feed1.ffm
ffmpeg -i video2.avi http://localhost:8090/feed1.ffm
ffmpeg -i video3.avi http://localhost:8090/feed1.ffm

where these commands would be called from a CGI script on a website
for example, and ffserver would play the clips back to back, and
display the logo when nothing is in the queue.

To me it would seem this is the right way to do it...

At the moment if you try and connect to ffserver before a live feed is
connected you just get an error - would it not be much better to
display a logo (a jpeg feed) until the content becomes available.

If the upload to ffserver fails for some reason (say a network outage
between the source and the ffserver), the current server will stop
sending, and the client will stop, again would it not be much better
to display the logo until the feed reconnects?

These features would seem of general benefit to ffserver. Why would
you not want them?

Cheers,
Keean.
_______________________________________________
libav-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: modifying ffserver.

Luca Abeni
Hi Keean,

Keean Schupke wrote:
[...]
> Okay, I was thinking that each clip would be sequenced into ffserver
> using ffmpeg like:
>
> ffmpeg -i video1.avi http://localhost:8090/feed1.ffm
> ffmpeg -i video2.avi http://localhost:8090/feed1.ffm
> ffmpeg -i video3.avi http://localhost:8090/feed1.ffm
[...]
> These features would seem of general benefit to ffserver. Why would
> you not want them?

I am not saying that these features are useless or that I do not like
them; I was simply suggesting that all the "video editing" operations
can be performed in the program which feeds ffserver, instead of
performing them in ffserver (note that this program generally runs on
the same machine in which ffserver is running, and feeds it via the
network loopback interface, so there is no risk that ffserver is not
properly feeded).

I think this is the simplest (and maybe cleaner) solution: ffserver
only cares about streaming, and some other program performs the video
editing, transcoding, etc... and feeds ffserver.
Of course, feel free to prove that I am wrong ;-)


                                Luca
_______________________________________________
libav-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: modifying ffserver.

Keean Schupke-2
On 11/06/2008, Luca Abeni <[hidden email]> wrote:

> I am not saying that these features are useless or that I do not like
>  them; I was simply suggesting that all the "video editing" operations
>  can be performed in the program which feeds ffserver, instead of
>  performing them in ffserver (note that this program generally runs on
>  the same machine in which ffserver is running, and feeds it via the
>  network loopback interface, so there is no risk that ffserver is not
>  properly feeded).
>
>  I think this is the simplest (and maybe cleaner) solution: ffserver
>  only cares about streaming, and some other program performs the video
>  editing, transcoding, etc... and feeds ffserver.
>  Of course, feel free to prove that I am wrong ;-)
>
>
>
>                                 Luca
>  _______________________________________________

If I write a separate program, how would my CGI scripts tell it which
clips to play next?

ffmpeg can generate a stream from a jpeg, so thats the logo sorted. I
then need some way of telling a running ffmpeg to switch to playing a
clip file instead of the jpeg...

When you give ffmpeg a list of files to join together:

ffmpeg -i video1.avi -i video2.avi -i video3.avi

It must store a list of files to read in an internal list. If I would
write say a simple socket remote control interface, so that you could
give it commands like:

PLAY video1.avi

and have that append to the list of files to play, then that would be
half the problem solved... I just need to figure out a way of getting
it to play the single frame jpeg when there is nothing in the list
instead of quitting.

What do you think? Any suggestions of where to look in the code?

Cheers,
Keean.
_______________________________________________
libav-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: modifying ffserver.

Luca Abeni
Hi Keean,

Keean Schupke wrote:
[...]
> If I write a separate program, how would my CGI scripts tell it which
> clips to play next?

I do not know... There are a lot of possible solutions: for example,
you can implement some kind of playlist functionalities, or you can
make your program controllable through a socket or a pipe, or you can
design your program to play all the files that it can find in a
specified directory (removing a file after playing it, and checking
for new files every time a file is eneded), ...

> ffmpeg can generate a stream from a jpeg, so thats the logo sorted. I
> then need some way of telling a running ffmpeg to switch to playing a
> clip file instead of the jpeg...

The easiest way to address this problem could be the following: look
at the "for(; received_sigterm == 0;) {" loop inside av_encode().
Such loop contains an "if (file_index < 0) {" condition to exit when
no input files are available. You can modify it, removing the "break;"
statement and using your jpeg picture as an input frame.
Of course you will have to modify the timestamps computations a little
bit (to allow "chaining" different files one after the other, and to
insert your frames coming from the jpeg file).


> When you give ffmpeg a list of files to join together:
>
> ffmpeg -i video1.avi -i video2.avi -i video3.avi
>
> It must store a list of files to read in an internal list.

A word of warning here: ffmpeg reads all the input files
simultaneously; if I understand well you want to read them sequentially
(one at time). So, you might want to insert some code in the
"if (file_index < 0) {" to check for the next file to read.


> If I would
> write say a simple socket remote control interface, so that you could
> give it commands like:
>
> PLAY video1.avi
>
> and have that append to the list of files to play, then that would be
> half the problem solved...
Yes, this could be a solution.


                                Luca
_______________________________________________
libav-user mailing list
[hidden email]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user
Loading...