AppSrc and video framerate
Jannis Achstetter
jannis_achstetter at web.de
Mon Apr 13 11:16:43 PDT 2015
Hi there.
I want to provide video frames to a gst pipeline via appsrc.
The frames are generated from a kind of framebuffer/composited scene,
i.e. I can pull a frame whenever I want. However, I cannot seek, the
content of the framebuffer is "live". So I set the properties "is-live"
and "do-timestamp" of the appsrc-element to true, assuming I don't have
to worry about timestamps.
The pipeline looks like:
appsrc name=audiosrc_monitor
caps="audio/x-raw,format=F32LE,rate=48000,layout=interleaved,channels=2"
is-live=true blocksize=32768 ! audiorate ! jackaudiosink sync=false
client-name=monitor
appsrc name=main
caps="audio/x-raw,format=F32LE,rate=48000,layout=interleaved,channels=2"
is-live=true blocksize=32768 format=time do-timestamp=true ! audiorate !
tee name=audio_main ! queue ! jackaudiosink sync=false client-name=main
connect=0
audio_main. ! queue ! audioconvert ! vorbisenc ! webmmux streamable=true
name=mux ! tee name=muxout ! queue ! filesink location=test.mkv sync=false
appsrc name=videosrc
caps="video/x-raw,format=BGRA,width=640,height=360,framerate=25/1,pixel-aspect-ratio=1/1"
is-live=true blocksize=921600 format=time do-timestamp=true ! queue !
videorate ! videoconvert ! vp8enc threads=4 deadline=35000
name=encoder_primary ! mux.
muxout. ! queue ! tcpserversink host=0.0.0.0 port=6000"
I assume that the clock of pipeline is set/fed by one of the
jackaudiosink elements.
When I use the appsrc in pull mode, it pulls frames (needData callback)
very fast (at least more often then 25 times per second), which is okay
since I can provide video data at any time. The videorate element makes
a nice stream with 25fps at the output. If I leave out the videorate
element, the frames get pulled at the same rate, making the resulting
video too slow since there are too many video frames for one second of
audio.
So the question is: Why doesn't it just pull 25 frames of video data per
second but more?
In the first case (with videorate), one can also see that frames are
repeated at the output. This is as bad as one "still" from the
framebuffer can repeat 5 times in the resulting video, making the
playback's speed correct but stuttering.
What I can do is to use push-mode and have a periodic 40ms-timer in my
application. But that feels a little wonky since the audio-cards clock
will drift from the "system clock" used for my timer.
What is the correct/best solution for my problem?
If I can find the time, I can provide a sample of the stuttering output
from a known input sample (big buck bunny or s.th.).
Best regards,
Jannis
More information about the gstreamer-devel
mailing list