Pause record and continue record in mp4mux

chocomaro7648 rub648 at gmail.com
Mon Nov 11 01:16:40 PST 2013


Hi, all:

Recently, I tried to use Gstreamer to stream video/audio, and record the
video simultaneously.

my pipeline is like this, and implement in C code application:

    gst-launch updsrc ! mpegtsdemux name=d \
    d.video_00 ! queue ! h264parse ! tee name=vtee ! \                      
// demux video
    vtee. ! queue ! omx_h264dec ! omx_ctrl ! omx_videosink \                
// video display
    vtee. ! queue ! mp4mux name=mux \                                       
// video record into mp4mux (record branch)
    d.audio_00 ! queue ! faad ! tee name=atee ! \                           
// demux audio
    atee. ! alsasink \                                                      
// audio display
    mux. ! filesink location=/mnt/record_pipe.mp4                           
// mux .mp4 file

I get the video(h264) and audio from UDP port, so I just throughout the h264
data into mp4 container.
It do works by ending the filesink with buffer-probe+EOS event!

And now, I have one more feature.
I want to pause recording until I decide to record again.
I do not mean record two files. I just want to record in one file but bypass
some buffer data.
But I can't get the right result.

I pause the record by the operations: 
    (1) buffer-probe on vtee src pad
    (2) unlink record branch and set it to PAUSED state
    (3) release the request src pad on vtee
I continue to record by the operations:
    (1) request a src pad on vtee
    (2) buffer-probe on vtee src pad
    (3) link record branch and set it to PLAYING state
    (4) unblock the request pad

The problem is, the timestamp of the recorded file do not work as I
expected.
If I record the video like "record 1st part -> pause -> continue to record
2nd part".
I expected it will be played like "play 1st part -> play 2nd part"
The mp4 file will be played like "play 1st part -> freeze -> continue to
play 2nd part".
Sorry I can't find better way to describe that...

I google about this issue, and find two ways to resolve.
1. resettime plugin:
    but It's not the pause case.
2. new segment event:
    but I don't know how to do exactly.

Since the resettime plugin do not work in this case, I tried to use
"new-segment" event.
    (1) when I pause the record, I want to get the timestamp by
GST_BUFFER_TIMESTAMP(buffer) in buffer-probe but always get "timestamp=0".
    (2) because I get "timestamp=0" before, I continue to record and
gst_pad_send_event() a gst_event_new_new_segment(TURE, FORMAT_TIME, 0, -1,
0) on vtee sink pad before unblock pad.
        And the pipeline just hang on!

my question is 
    (1) Why I always get the timestamp=0?
    (2) How to use the new-segment event to solve this issue?

If any info you need, please let me know. Thank you very much!



--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Pause-record-and-continue-record-in-mp4mux-tp4663227.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list