How to play mpeg4 dump (in a fifo)

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

How to play mpeg4 dump (in a fifo)

Nezer Zaidenberg
Hi All,

I have a live source (webcam) that I want to record continuously without losing any video - but also be able to playback everything up to the last minute. I am trying to dump the video to a fifo and then record it from the fifo one minute at a time.

The problem is that it seems there is a problem with the timestamps. It looks like gstreamer expects a clock to be supplied by the filesrc but that doesn't happen. 
Specifically when I try to play the pipe instead of record it, I get choppy video and a warning is emitted about the timestamps.

Does anyone know how I could record an mpeg stream from a fifo?

For reference, here are the pipelines:
source pipe:
gst-launch rtspsrc location="<webcam>" ! rtpmp4vdepay ! filesink location=pipe

record pipe:
gst-launch filesrc location=pipe ! 'video/mpeg, mpegversion=4, systemstream=false, width=320, height=240. framerate=(fraction)30/1, codec_data=...' ! matroskamux ! filesink location="1.mkv"

play pipe:
gst-launch filesrc location=pipe ! 'video/mpeg, mpegversion=4, systemstream=false, width=320, height=240. framerate=(fraction)30/1, codec_data=...' ! ffdec_mpeg4 ! ffmpegcolorspace ! autovideosink

Thanks,
  Tomer & Nezer



_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to play mpeg4 dump (in a fifo)

Tomer Margalit
Hi All,

You can ignore the question -- I have found the solution - gdp{pay,depay}. However I have switched to a better mechanism shm{src,sink}.

Thanks,
  Tomer

On Mon, Nov 28, 2011 at 1:34 PM, Nezer Zaidenberg <[hidden email]> wrote:
Hi All,

I have a live source (webcam) that I want to record continuously without losing any video - but also be able to playback everything up to the last minute. I am trying to dump the video to a fifo and then record it from the fifo one minute at a time.

The problem is that it seems there is a problem with the timestamps. It looks like gstreamer expects a clock to be supplied by the filesrc but that doesn't happen. 
Specifically when I try to play the pipe instead of record it, I get choppy video and a warning is emitted about the timestamps.

Does anyone know how I could record an mpeg stream from a fifo?

For reference, here are the pipelines:
source pipe:
gst-launch rtspsrc location="<webcam>" ! rtpmp4vdepay ! filesink location=pipe

record pipe:
gst-launch filesrc location=pipe ! 'video/mpeg, mpegversion=4, systemstream=false, width=320, height=240. framerate=(fraction)30/1, codec_data=...' ! matroskamux ! filesink location="1.mkv"

play pipe:
gst-launch filesrc location=pipe ! 'video/mpeg, mpegversion=4, systemstream=false, width=320, height=240. framerate=(fraction)30/1, codec_data=...' ! ffdec_mpeg4 ! ffmpegcolorspace ! autovideosink

Thanks,
  Tomer & Nezer




_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to play mpeg4 dump (in a fifo)

Mailing List SVR
In reply to this post by Nezer Zaidenberg
Il 28/11/2011 12:34, Nezer Zaidenberg ha scritto:
Hi All,

I have a live source (webcam) that I want to record continuously without losing any video - but also be able to playback everything up to the last minute. I am trying to dump the video to a fifo and then record it from the fifo one minute at a time.

The problem is that it seems there is a problem with the timestamps. It looks like gstreamer expects a clock to be supplied by the filesrc but that doesn't happen. 
Specifically when I try to play the pipe instead of record it, I get choppy video and a warning is emitted about the timestamps.

Does anyone know how I could record an mpeg stream from a fifo?

For reference, here are the pipelines:
source pipe:
gst-launch rtspsrc location="<webcam>" ! rtpmp4vdepay ! filesink location=pipe

record pipe:
gst-launch filesrc location=pipe ! 'video/mpeg, mpegversion=4, systemstream=false, width=320, height=240. framerate=(fraction)30/1, codec_data=...' ! matroskamux ! filesink location="1.mkv"

play pipe:
gst-launch filesrc location=pipe ! 'video/mpeg, mpegversion=4, systemstream=false, width=320, height=240. framerate=(fraction)30/1, codec_data=...' ! ffdec_mpeg4 ! ffmpegcolorspace ! autovideosink

try to add do-timestamp=true to the filesrc element (or sync=false to the videosink), however gstreamer allow to record and play with only 1 pipeline, no need for this hack:

http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-plugins/html/gstreamer-plugins-tee.html
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gstreamer-app.html

Nicola


Thanks,
  Tomer & Nezer




_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to play mpeg4 dump (in a fifo)

Nezer Zaidenberg
Hi Nicola,

Thanks, but I have read somewhere that I am better off using pad-block or appsrc/sink (as you mentioned) since I want to connect two pipelines in the same process.
(as a side note, I used gdp[de]pay successfully to implement what I wanted).

I have considered using the pad-block - but it is too complicated and it is underdocumented. For instance jokosher used pad-block not knowing that it needs buffers to have the signal flushed and they only found it out by a mail in the mailing list.

Also, I don't want to stop the whole pipeline to finalize every one-minute recording - when I try to send an eos to a regular recording, it usually takes a couple of seconds for it to finalize - and I don't want the user to experience this video freeze.

I would like your opinion about something else (sorry if I am being too bold) - appsink and appsrc are very general (good) ideas.
But what I am really looking for is a way to create a global queue - and have one pipeline filling it and another (or others) emptying it.
What I imagine (actually what I plan to implement) is a "queuesink" that just queues the buffers it gets in a global queue, and a "queuesrc" that takes a global queue and drains it.
This would also fit well with all the other pipeline communication ways like shm{sink,src}, tcp{client,server}{sink,src}, udp{src,sink}, and even file{src,sink} that use a pipe.

Now appsink and appsrc involve a lot of hacking to achieve this (attaching signal handlers and removing them when a pipeline is destroyed in a synchronized way) relatively, just to have simple handlers that only save the buffers in a queue - a concept which plays a central role in gstreamer already - and thus has a strong stable implementation already.

I feel that this simple idea will not gain much by using the full power of the app{sink,src}, and would rather use an element that does this job itself.

Is there any element today in gstreamer that does this?
If not, and if I implement such an element, do you have any advice/remarks?

Thanks,
  Tomer

On Mon, Nov 28, 2011 at 4:23 PM, Mailing List SVR <[hidden email]> wrote:
Il 28/11/2011 12:34, Nezer Zaidenberg ha scritto:
Hi All,

I have a live source (webcam) that I want to record continuously without losing any video - but also be able to playback everything up to the last minute. I am trying to dump the video to a fifo and then record it from the fifo one minute at a time.

The problem is that it seems there is a problem with the timestamps. It looks like gstreamer expects a clock to be supplied by the filesrc but that doesn't happen. 
Specifically when I try to play the pipe instead of record it, I get choppy video and a warning is emitted about the timestamps.

Does anyone know how I could record an mpeg stream from a fifo?

For reference, here are the pipelines:
source pipe:
gst-launch rtspsrc location="<webcam>" ! rtpmp4vdepay ! filesink location=pipe

record pipe:
gst-launch filesrc location=pipe ! 'video/mpeg, mpegversion=4, systemstream=false, width=320, height=240. framerate=(fraction)30/1, codec_data=...' ! matroskamux ! filesink location="1.mkv"

play pipe:
gst-launch filesrc location=pipe ! 'video/mpeg, mpegversion=4, systemstream=false, width=320, height=240. framerate=(fraction)30/1, codec_data=...' ! ffdec_mpeg4 ! ffmpegcolorspace ! autovideosink

try to add do-timestamp=true to the filesrc element (or sync=false to the videosink), however gstreamer allow to record and play with only 1 pipeline, no need for this hack:

http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-plugins/html/gstreamer-plugins-tee.html
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gstreamer-app.html

Nicola


Thanks,
  Tomer & Nezer




_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel



_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

Re: How to play mpeg4 dump (in a fifo)

Mailing List SVR
Il 29/11/2011 16:07, Nezer Zaidenberg ha scritto:
Hi Nicola,

Thanks, but I have read somewhere that I am better off using pad-block or appsrc/sink (as you mentioned) since I want to connect two pipelines in the same process.
(as a side note, I used gdp[de]pay successfully to implement what I wanted).

I have considered using the pad-block - but it is too complicated and it is underdocumented. For instance jokosher used pad-block not knowing that it needs buffers to have the signal flushed and they only found it out by a mail in the mailing list.

Also, I don't want to stop the whole pipeline to finalize every one-minute recording - when I try to send an eos to a regular recording, it usually takes a couple of seconds for it to finalize - and I don't want the user to experience this video freeze.

I would like your opinion about something else (sorry if I am being too bold) - appsink and appsrc are very general (good) ideas.

in an app of mine I'm using something like this:

source -> <some other elements> -> appsink

appsrc -> <some other elements> filesink

when I stop the second pipeline and change the filesink location I put the buffer from appsink in a gst_atomic_queue, and when the second pipeline is ready again I empty the queue.

I think this is considered an hack too, however works fine for me and I have all in the same app,

Nicola

But what I am really looking for is a way to create a global queue - and have one pipeline filling it and another (or others) emptying it.
What I imagine (actually what I plan to implement) is a "queuesink" that just queues the buffers it gets in a global queue, and a "queuesrc" that takes a global queue and drains it.
This would also fit well with all the other pipeline communication ways like shm{sink,src}, tcp{client,server}{sink,src}, udp{src,sink}, and even file{src,sink} that use a pipe.

Now appsink and appsrc involve a lot of hacking to achieve this (attaching signal handlers and removing them when a pipeline is destroyed in a synchronized way) relatively, just to have simple handlers that only save the buffers in a queue - a concept which plays a central role in gstreamer already - and thus has a strong stable implementation already.

I feel that this simple idea will not gain much by using the full power of the app{sink,src}, and would rather use an element that does this job itself.

Is there any element today in gstreamer that does this?
If not, and if I implement such an element, do you have any advice/remarks?

Thanks,
  Tomer

On Mon, Nov 28, 2011 at 4:23 PM, Mailing List SVR <[hidden email]> wrote:
Il 28/11/2011 12:34, Nezer Zaidenberg ha scritto:
Hi All,

I have a live source (webcam) that I want to record continuously without losing any video - but also be able to playback everything up to the last minute. I am trying to dump the video to a fifo and then record it from the fifo one minute at a time.

The problem is that it seems there is a problem with the timestamps. It looks like gstreamer expects a clock to be supplied by the filesrc but that doesn't happen. 
Specifically when I try to play the pipe instead of record it, I get choppy video and a warning is emitted about the timestamps.

Does anyone know how I could record an mpeg stream from a fifo?

For reference, here are the pipelines:
source pipe:
gst-launch rtspsrc location="<webcam>" ! rtpmp4vdepay ! filesink location=pipe

record pipe:
gst-launch filesrc location=pipe ! 'video/mpeg, mpegversion=4, systemstream=false, width=320, height=240. framerate=(fraction)30/1, codec_data=...' ! matroskamux ! filesink location="1.mkv"

play pipe:
gst-launch filesrc location=pipe ! 'video/mpeg, mpegversion=4, systemstream=false, width=320, height=240. framerate=(fraction)30/1, codec_data=...' ! ffdec_mpeg4 ! ffmpegcolorspace ! autovideosink

try to add do-timestamp=true to the filesrc element (or sync=false to the videosink), however gstreamer allow to record and play with only 1 pipeline, no need for this hack:

http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gstreamer-plugins/html/gstreamer-plugins-tee.html
http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-base-libs/html/gstreamer-app.html

Nicola


Thanks,
  Tomer & Nezer




_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel




_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel