Oracle Multimedia provides the ORD_VIDEO PL/SQL package. This package provides procedures to perform common operations such as importing and exporting video data to and from operating system files, and extracting information from video data. See Procedures Common to All Oracle Multimedia PL/SQL Package APIs for information about exporting and importing video data to and from operating system files. This package adds Oracle Multimedia support to video data stored in BLOBs and BFILEs.
The ORD_VIDEO package is defined in the ordvrpsp.sql
file. After installation, this file is available in the Oracle home directory at:
<ORACLE_HOME>
/ord/im/admin
(on Linux and UNIX)
<ORACLE_HOME>
\ord\im\admin
(on Windows)
The examples in these topics assume that the TVID table and the VIDEODIR directory exist. (See Examples for Oracle Multimedia PL/SQL Packages for more information about the tables and directories used in these examples.)
See the following topics for details about the procedures in the ORD_VIDEO PL/SQL package:
Format
getProperties(videoBfile IN OUT NOCOPY BFILE, attributes IN OUT NOCOPY CLOB);
Description
Reads the video data stored in a BFILE to get the values of the media attributes for supported formats, and then stores them in the input CLOB. This procedure populates the CLOB with a set of format and application properties in XML form.
Parameters
Usage Notes
None.
Pragmas
None.
Exceptions
None.
Examples
Get the property information for known video attributes:
DECLARE vid_attrib CLOB; vid_data BFILE := BFILENAME('VIDEODIR','testvid.dat'); BEGIN DBMS_LOB.CREATETEMPORARY(vid_attrib, FALSE, DBMS_LOB.CALL); -- get properties from bfile ORDSYS.ORD_VIDEO.getProperties(vid_data, vid_attrib); -- print length of extracted properties DBMS_OUTPUT.PUT_LINE('Size of XML Annotations ' || TO_CHAR(DBMS_LOB.GETLENGTH(vid_attrib))); EXCEPTION WHEN OTHERS THEN RAISE; END; /
Format
getProperties(videoBfile IN OUT NOCOPY BFILE, mimeType OUT VARCHAR2, format OUT VARCHAR2, width OUT INTEGER, height OUT INTEGER, frameResolution OUT INTEGER, frameRate OUT INTEGER, videoDuration OUT INTEGER, numberOfFrames OUT INTEGER, compressionType OUT VARCHAR2, numberOfColors OUT INTEGER, bitRate OUT INTEGER);
Description
Reads the video data stored in a BFILE to get the values of the media attributes for supported formats, and then returns them as explicit parameters. This procedure extracts the properties for these attributes of the video data: MIME type, format, frame size, height, width, frame resolution, frame rate, video duration, number of frames, compression type, number of colors, and bit rate.
Parameters
The video data represented as a BFILE.
The MIME type of the video data.
The format of the video data.
The width of the frame in pixels of the video data.
The height of the frame in pixels of the video data.
The number of pixels per inch of frames in the video data.
The number of frames per second at which the video data was recorded.
The total time required to play the video data.
The total number of frames in the video data.
The compression type of the video data.
The number of colors in the video data.
The bit rate in the video data.
Usage Notes
If a property cannot be extracted from the media source, then the respective parameter is set to NULL.
Pragmas
None.
Exceptions
None.
Examples
Get the property information for known video attributes:
DECLARE vid_data BFILE := BFILENAME('VIDEODIR','testvid.dat'); mimeType VARCHAR2(80); format VARCHAR2(32) := NULL; width NUMBER; height NUMBER; frameResolution NUMBER; frameRate NUMBER; videoDuration NUMBER; numberOfFrames NUMBER; compressionType VARCHAR2(160); numberOfColors NUMBER; bitRate NUMBER; BEGIN -- get properties from bfile ORDSYS.ORD_VIDEO.getProperties(vid_data, mimeType, format, width, height, frameResolution, frameRate, videoDuration, numberOfFrames, compressionType, numberOfColors, bitRate); -- print properties DBMS_OUTPUT.PUT_LINE('mimeType: ' || mimeType ); DBMS_OUTPUT.PUT_LINE('format: ' || format ); DBMS_OUTPUT.PUT_LINE('width: ' || width ); DBMS_OUTPUT.PUT_LINE('height: ' || height ); DBMS_OUTPUT.PUT_LINE('frameResolution: ' || frameResolution ); DBMS_OUTPUT.PUT_LINE('frameRate: ' || frameRate ); DBMS_OUTPUT.PUT_LINE('videoDuration: ' || videoDuration ); DBMS_OUTPUT.PUT_LINE('numberOfFrames: ' || numberOfFrames ); DBMS_OUTPUT.PUT_LINE('compressionType: ' || compressionType ); DBMS_OUTPUT.PUT_LINE('numberOfColors: ' || numberOfColors ); DBMS_OUTPUT.PUT_LINE('bitRate: ' || bitRate ); EXCEPTION WHEN OTHERS THEN RAISE; END; /
Format
getProperties(videoBlob IN BLOB, attributes IN OUT NOCOPY CLOB);
Description
Reads the video data stored in a BLOB to get the values of the media attributes for supported formats, and then stores them in the input CLOB. This procedure extracts the values for these attributes of the video data: MIME type, format, frame size, height, width, frame resolution, frame rate, video duration, number of frames, compression type, number of colors, and bit rate. This procedure populates the CLOB with a set of format and application properties in XML form.
Parameters
Usage Notes
None.
Pragmas
None.
Exceptions
ORDSourceExceptions.EMPTY_SOURCE
This exception is raised when the input videoBLOB parameter is NULL.
Examples
Get the property information for known video attributes:
DECLARE vid_attrib CLOB; vid_data BLOB; BEGIN SELECT vid, attributes INTO vid_data, vid_attrib FROM tvid WHERE N=1 FOR UPDATE; -- get properties from blob ORDSYS.ORD_VIDEO.getProperties(vid_data, vid_attrib); -- print length of extracted properties DBMS_OUTPUT.PUT_LINE('Size of XML Annotations ' || TO_CHAR(DBMS_LOB.GETLENGTH(vid_attrib))); UPDATE tvid SET vid=vid_data, attributes=vid_attrib WHERE N=1; COMMIT; EXCEPTION WHEN OTHERS THEN RAISE; END; /
Format
getProperties(videoBLOB IN BLOB, mimeType OUT VARCHAR2, format OUT VARCHAR2, width OUT INTEGER, height OUT INTEGER, frameResolution OUT INTEGER, frameRate OUT INTEGER, videoDuration OUT INTEGER, numberOfFrames OUT INTEGER, compressionType OUT VARCHAR2, numberOfColors OUT INTEGER, bitRate OUT INTEGER);
Description
Reads the video data stored in a BLOB to get the values of the media attributes for supported formats, and then returns them as explicit parameters. This procedure extracts the properties for these attributes of the video data: MIME type, format, frame size, height, width, frame resolution, frame rate, video duration, number of frames, compression type, number of colors, and bit rate.
Parameters
The video data represented as a BLOB.
The MIME type of the video data.
The format of the video data.
The width of the frame in pixels of the video data.
The height of the frame in pixels of the video data.
The number of pixels per inch of frames in the video data.
The number of frames per second at which the video data was recorded.
The total time required to play the video data.
The total number of frames in the video data.
The compression type of the video data.
The number of colors in the video data.
The bit rate in the video data.
Usage Notes
If a property cannot be extracted from the media source, then the respective parameter is set to NULL.
Pragmas
None.
Exceptions
ORDSourceExceptions.EMPTY_SOURCE
This exception is raised when the input videoBLOB parameter is NULL.
Examples
Get the property information for known video attributes:
DECLARE vid_data BLOB; mimeType VARCHAR2(80); format VARCHAR2(32):=NULL; width NUMBER; height NUMBER; frameResolution NUMBER; frameRate NUMBER; videoDuration NUMBER; numberOfFrames NUMBER; compressionType VARCHAR2(160); numberOfColors NUMBER; bitRate NUMBER; BEGIN SELECT vid, mimetype, format, width, height, frameresolution, framerate, videoduration, numberofframes, compressiontype, numberofcolors, bitrate INTO vid_data, mimeType, format, width, height, frameResolution, frameRate, videoDuration, numberOfFrames, compressionType, numberOfColors, bitRate FROM tvid WHERE N=1 FOR UPDATE; -- get properties from blob ORDSYS.ORD_VIDEO.getProperties(vid_data, mimeType, format, width, height, frameResolution, frameRate, videoDuration, numberOfFrames, compressionType, numberOfColors, bitRate); -- print properties DBMS_OUTPUT.PUT_LINE('mimeType: ' || mimeType ); DBMS_OUTPUT.PUT_LINE('format: ' || format ); DBMS_OUTPUT.PUT_LINE('width: ' || width ); DBMS_OUTPUT.PUT_LINE('height: ' || height ); DBMS_OUTPUT.PUT_LINE('frameResolution: ' || frameResolution ); DBMS_OUTPUT.PUT_LINE('frameRate: ' || frameRate ); DBMS_OUTPUT.PUT_LINE('videoDuration: ' || videoDuration ); DBMS_OUTPUT.PUT_LINE('numberOfFrames: ' || numberOfFrames ); DBMS_OUTPUT.PUT_LINE('compressionType: ' || compressionType ); DBMS_OUTPUT.PUT_LINE('numberOfColors: ' || numberOfColors ); DBMS_OUTPUT.PUT_LINE('bitRate: ' || bitRate ); UPDATE tvid SET vid=vid_data, mimetype=mimeType, format=format, width=width, height=height, frameresolution=frameResolution, framerate=frameRate, videoduration=videoDuration, numberofframes=numberOfFrames, compressiontype=compressionType, numberofcolors=numberOfColors, bitrate=bitRate WHERE N=1; COMMIT; EXCEPTION WHEN OTHERS THEN RAISE; END; /