[Live-devel] Scaling a H264 elementary stream
Bruno Abreu
bruno.abreu at livingdata.pt
Wed Jan 30 10:17:31 PST 2013
Hello everyone,
we've just developed a H264 video stream filter that allows scaling.
Fast-forward and slow-motion, only, reverse-play is not contemplated.
It works by adjusting the presentation time and frame duration of each frame
based on the current scale factor, thus speeding up or slowing down frame
pulling form the upstream source and delivery to the downstream sink.
We set up our pipeline like this:
ByteFileFileSource -> H264VideoStreamFramer ->
ScalableH264VideoStreamDiscreteFramer -> H264VideoRTPSink
Our ByteFileFileSource reads a H264 elementary stream and feeds it to the
H264VideoStreamFramer. After that we use our scalable filter which extends
H264VideoStreamDiscreteFramer. We know a discrete framer is supposed to be used
for discrete sources, not when reading from a file. But we tried using a
FramedFilter extension and that doesn't work because H264VideoRTPSink requires
its source to be a H264VideoStreamFramer. And, since our source is already split
into frames by the previous element, the H264VideoStreamDiscreteFramer suited
this task just fine.
This might not be a "correct way" of implementing scale on H264 video streams,
but is working very well for us. We are aware that other, maybe better,
techniques are available. Namely those in which only the I-frames are sent. That
is exactly the downside to this method: every frame is sent to the client and,
for high scale factors, the client has to work harder in decoding them at higher
rates. On the other hand, it doesn't require index files neither do we need to
encapsulate our elementary stream in a container.
We implement the mandatory
- virtual void testScaleFactor(float& scale);
- virtual void setStreamSourceScale(FramedSource* inputSource, float scale);
methods in our H264VideoFileServerMediaSubsession and, when
setStreamSourceScale(FramedSource* inputSource, float scale) is called, we call
setScaleFactor(float scale) on our filter.
We've been using VLC as the client for testing.
Any suggestions in improving this filter are welcome.
Thank you,
Bruno Abreu
--
Living Data - Sistemas de Informação e Apoio à Decisão, Lda.
LxFactory - Rua Rodrigues de Faria, 103,
edifício I - 4º piso Phone: +351 213622163
1300-501 LISBOA Fax: +351 213622165
Portugal URL: www.livingdata.pt
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ScalableH264VideoStreamDiscreteFramer.hh
Type: text/x-c++hdr
Size: 2229 bytes
Desc: not available
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20130130/a1ec669b/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: ScalableH264VideoStreamDiscreteFramer.cpp
Type: text/x-c++src
Size: 5090 bytes
Desc: not available
URL: <http://lists.live555.com/pipermail/live-devel/attachments/20130130/a1ec669b/attachment-0001.bin>
More information about the live-devel
mailing list