XineInput

Input object reading images from a video file using Xine.  If set up properly, Xine will support reading of various media.  You will be able to read DVD, Video CD, DVB, V4L, DXR3, MMS, PNM, RTSP, HTTP, and ordinary files.  Xine supports many container formats such as MPG/MPEG/MPEG-TS, OGG, AVI, ASF, MOV/MP4, MPV/M2V, CPK, ROQ, FLI, RM/RA/RAM, DV, YUV4MPEG2, MJPEG, and NSV.  Xine also provides unpacking of various video codecs such as MPEG1, MPEG2, MPEG4, MS MPEG4, DivX 3/4/5, WMV7/WMV8/WMV9, MJPEG, Cinepak, DV, MSVC, MSRLE, SVQ1/SVQ3, CYUV, ROQ, QT RLE/SMC/RPZA, Theora, Indeo, On2, I263, Real Media.  If you access a streaming server, note that the server may close the connection if your application does not accept the frames in real-time.

I recommend to install the w32codecs-package to be able to access proprietary video formats.  You also need to install libdvdcss if you want to read encrypted DVDs.  Note that there are still countries with laws restricting the free distribution of video decompression software for some codecs.

Inherits

See also

Summary
XineInputInput object reading images from a video file using Xine.
Constants
Stream information constants.Constants for requesting different types of information about the stream.
Properties
posRead and write stream-position in milliseconds.
lengthGet length of video in milliseconds.
widthGet width of video frames.
heightGet height of video frames.
Functions
XineInput.newSome possible values for the media resource location are
closeClose the video player.
inspectReturn string with information about this object.
readRead an image.
status?Indicates whether the video input is still ok.
stream_infoRequest information about the video stream.
frame_duration.Deprecated method.

Constants

Stream information constants.

Constants for requesting different types of information about the stream.

XINE_STREAM_INFO_BITRATEbit rate
XINE_STREAM_INFO_SEEKABLEseekable
XINE_STREAM_INFO_VIDEO_WIDTHwidth
XINE_STREAM_INFO_VIDEO_HEIGHTheight
XINE_STREAM_INFO_VIDEO_RATIOratio * 10000
XINE_STREAM_INFO_VIDEO_CHANNELSchannels
XINE_STREAM_INFO_VIDEO_STREAMSstreams
XINE_STREAM_INFO_VIDEO_BITRATEbitrate
XINE_STREAM_INFO_VIDEO_FOURCCfourcc
XINE_STREAM_INFO_VIDEO_HANDLEDcodec available?
XINE_STREAM_INFO_FRAME_DURATIONframe duration / 90000 sec
XINE_STREAM_INFO_AUDIO_CHANNELSaudio channels
XINE_STREAM_INFO_AUDIO_BITSaudio bits
XINE_STREAM_INFO_AUDIO_SAMPLERATEsample rate
XINE_STREAM_INFO_AUDIO_BITRATEbit rate
XINE_STREAM_INFO_AUDIO_FOURCCfourcc
XINE_STREAM_INFO_AUDIO_HANDLEDcodec available?
XINE_STREAM_INFO_HAS_CHAPTERShas chapters?
XINE_STREAM_INFO_HAS_VIDEOhas video?
XINE_STREAM_INFO_HAS_AUDIOhas audio?
XINE_STREAM_INFO_IGNORE_VIDEOignore video
XINE_STREAM_INFO_IGNORE_AUDIOignore audio
XINE_STREAM_INFO_IGNORE_SPUignore spu
XINE_STREAM_INFO_VIDEO_HAS_STILLhas still?
XINE_STREAM_INFO_MAX_AUDIO_CHANNELmax audio channel
XINE_STREAM_INFO_MAX_SPU_CHANNELmax spu channel
XINE_STREAM_INFO_AUDIO_MODEaudio mode
XINE_STREAM_INFO_SKIPPED_FRAMESfor 1000 frames delivered
XINE_STREAM_INFO_DISCARDED_FRAMESfor 1000 frames delivered
XINE_STREAM_INFO_VIDEO_AFDvideo afd
XINE_STREAM_INFO_DVD_TITLE_NUMBERtitle number
XINE_STREAM_INFO_DVD_TITLE_COUNTtitle count
XINE_STREAM_INFO_DVD_CHAPTER_NUMBERchapter number
XINE_STREAM_INFO_DVD_CHAPTER_COUNTchapter count
XINE_STREAM_INFO_DVD_ANGLE_NUMBERangle number
XINE_STREAM_INFO_DVD_ANGLE_COUNTangle count

Properties

pos

Read and write stream-position in milliseconds.  Setting the position does not work on some media and in other cases the resolution will depend on the position of keyframes.  Querying the current position seems to work in real-time mode.

length

Get length of video in milliseconds.  Some streams don’t have a known length (i.e. streaming media).  In this case 0 is returned.

width

Get width of video frames.

height

Get height of video frames.

Functions

XineInput.new

def XineInput.new(mrl,  
framegrab =  true)

Some possible values for the media resource location are

”dvd://1”First track of DVD
”vcd://”Read VCD
”file.mpg”Open video file with filename “file.mpg”

If framegrab is false, the video will play in real-time mode.  I.e. the read method will wait or skip frames depending on the frame rate and the speed of this application.

Parameters

mrlMedia resource location
framegrabUse Xine’s experimental framegrabbing interface

close

def close

Close the video player.  You can call this method to force destruction of this object.

inspect

def inspect

Return string with information about this object.

Returns

Returns a string which looks like this: “XineInput( \”file.mpg\” )”

read

def read

Read an image.

Returns

An object of type Frame_ or Sequence_

status?

def status?

Indicates whether the video input is still ok.  At the moment this method does not indicate whether more frames are available.  The Xine-API doesn’t offer this information.

stream_info

def stream_info(info)

Request information about the video stream.

frame_duration.

Deprecated method.  Use stream_info( XineInput::XINE_STREAM_INFO_FRAME_DURATION ) instead.

def XineInput.new(mrl,  
framegrab =  true)
Some possible values for the media resource location are
def close
Close the video player.
def inspect
Return string with information about this object.
def read
Read an image.
def status?
Indicates whether the video input is still ok.
def stream_info(info)
Request information about the video stream.
Base class for different types of input sources for images.
HornetsEye allows you to capture frames from videos by using Xine.
This Ruby program takes a video and generates a table of thumbnail images.
This class provides fast (multi-dimensional) Ruby arrays where all elements are of the same type.
Close