beautypg.com

Using the video output device, Using loopback on video output device – Sensoray 2253 Linux User Manual

Page 12

background image

Using the Video Output Device

The easiest way to play a file on the video output device is to pipe a recorded
file to it using the “write” method:

cat output.m4v > /dev/video2

The driver will attempt to detect the file format and set the decoder format
automatically. The video output device can only play back MPEG-4 and H.264
elementary streams, MP4 fragmented streams, and MPEG-TS.
The “playback” demo program includes an example on how to convert a
non-fragmented MP4 stream to a fragmented stream playable on the device.
The device will determine the dimensions of the compressed stream, and
there is no need to provide width and height parameters.
The “playback” demo may also be used to play uncompressed streams, but
require the format and dimensions be provided as parameters.
The video standard must be set manually for playback. Failure to do so may
result in a distorted image or incorrect frame rate. If the stream dimensions
are smaller than the display size (720x480 NTSC or 720x576 PAL) the image
will be centered in the display with a black border.
To play back the entire clip, the driver will block during the close syscall until
the all buffered video data has been decoded. To stop playback immediately
and discard buffered video data, use the VIDIOC_STREAMOFF ioctl or
VIDIOC_DECODER_CMD V4L2_DEC_CMD_STOP.

Using Loopback on Video Output Device

Use this command to test loopback of mp4 fragmented stream on video
output:
./capture -z -s 704x480 -g 1 -f 0 -o - | ./playback -
The capture demo flushes the output file descriptor after each frame and the
playback demo uses non-buffered io to keep latency at a minimum while
copying the stream over the host. This ensures that the complete packet of
an encoded frame is not delayed at any point, so that it can be decoded as
soon as possible. Similar measures should be taken by a streaming
application developer.
Using cat (for example: cat /dev/video0 > /dev/video2) to capture from the
device will introduce unnecessary 4k buffering of the stream. This buffering
will transfer partial frames, causing the decoder to wait until the complete
frame arrives, increasing the latency.
The playback demo uses a low-latency mode feature when playing from a
non-file source, allowing the device to automatically reduce latency when the
device determines that it has enough information to smoothly drop audio and
video frames. See also the ioctl control S2253_CID_LOW_LATENCY in the API
reference.

12

This manual is related to the following products: