I have worked out how to do it! Here goes....
connect system/<password>;
grant dba to <username>; -- you choose <username>
connect <username>/<password>;
create or replace directory VIDDIR as 'f:\videodir'; -- f:\videodir is my directory containing videos
disconnect
connect system/knighty;
grant read on directory VIDDIR to <username>;
connect <username>/<password>;
-- create table
create table avis(id number not null,
videoclip ORDSYS.ORDVideo,
constraint p primary key(id)
);
insert into avis values(1, ORDSYS.ORDVideo.init()); -- repeat 4 more times, as I have 5 video clips
set serveroutput on;
DECLARE
obj ORDSYS.ORDVideo;
ctx RAW(4000) :=NULL;
BEGIN
select videoclip INTO obj FROM avis WHERE id = 1 for UPDATE;
obj.setSource(‘FILE’,’VIDDIR’,’00001.avi’);
obj.import(ctx);
obj.setProperties(ctx);
update avis set videoclip = obj where id = 1;
COMMIT;
END;
/
-- Repeat for other 4 videos
--Now I can query the properties of these videos, which are stored inside the database, eg.
DECLARE
obj ORDSYS.ORDVideo;
width INTEGER;
height INTEGER;
ctx RAW(4000) := NULL;
BEGIN
SELECT videoclip INTO obj FROM avis WHERE id = 1 for UPDATE;
dbms_output.put_line('METHODS');
dbms_output.put_line('-------');
--dbms_output.put_line('Description: '||obj.getDescription); -- need to create manually and catch exception
dbms_output.put_line('Format: '||obj.getFormat);
dbms_output.put_line('MimeType: '||obj.getMimeType);
dbms_output.put_line('Source: '||obj.getSource);
--dbms_output.put_line('ContentLength: '||obj.getContentLength(ctx));
obj.getFrameSize(width, height);
dbms_output.put_line('Frame Size: Width: '||width||' , Height: '||height); -- need to create manually and catch exception
--dbms_output.put_line('Frame Resolution: '|| obj.getFrameResolution);
dbms_output.put_line('Frame Rate: '||obj.getFrameRate);
dbms_output.put_line('Video Duration: '||obj.getVideoDuration);
dbms_output.put_line('Number Of Frames: '||obj.getNumberOfFrames);
dbms_output.put_line('CompressionType: '||obj.getCompressionType);
dbms_output.put_line('Colors: '|| obj.getNumberOfColors);
dbms_output.put_line('Bit Rate: '||obj.getBitRate);
END;
/
I repeated these actions with another video (mpg format) and oracles intermedia package was able to retrieve the same properties as with the avi videos. In addition, I was able to retrieve the Bit Rate of mpg videos (unlike with avi's).
I hope this post is of use to someone else!