Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting videos in table and retreiving their properties????

Status
Not open for further replies.
Sep 16, 2002
3
GB
I am trying to insert videos (avi files) into a table and then want to retrieve the properties of these videos.

Do I have to set the properties such as format or does oracle's intermedia package do it automatically?

I have 5 avi video clips which I wish to insert into the table. I am getting really confused and cannot find any useful examples anywhere.

Any assistance on this problem is much appreciated.
 
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!


 
I now need to use Java (Java Media Framework) to play one of the video clips stored in the database. I am having difficulties specifying the locator string format for the Oracle interMedia Custom DataSource.

im://[<driverType>/]<jdbcConnectString>/<user>:<password>/<queryString>

Any assistance on this problem is much appreciated.
 
Hi aceboarder
your code seems workable but could you plz tell how to install thos ORDSYS packages
thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top