function takes input string, name of video. it's read video vision.videofilereader
function , returns same video, using thevision.videofilewriter
function. both input video output videos have audio. processing of video 6 mb, have output of video more 1 gb. function has no errors, have compress. using videocompressor
, can compress video 350 mb, use theaudiocompressor
, obtaining error. code, following error returned.
function [ nframes ] = showmovie( video ) v = videoreader(video); videofreader = vision.videofilereader(video); videofwriter = vision.videofilewriter('framerate',v.framerate,'audioinputport',1,'videocompressor', 'mjpeg compressor','audiocompressor','mjpeg compressor'); [audio,fs] = audioread(video); op=floor(fs/v.framerate); nframes = 0; while ~isdone(videofreader) nframes=nframes+1; frame=step(videofreader); audios=audio( (nframes-1)*op + 1 : nframes*op , : ); step(videofwriter,frame,audios); end release(videofreader); release(videofwriter); end
i can't use property audiocompressor
. tried both compressor mjpeg
, dv video encoder
value, error:
error using videofilewriter / step unable create audio compressor filter error in showmovie (line 15) step (videofwriter, frame, audios);
the audiocompressor compressor works in system is: 'none (uncompressed)'
tried on 64 bit version of matlab (r2014b).
reason windows system lacks x64 (64 bit) audio codec supported matlab.
note: 64 bit matlab requires x64 codecs, , 32 bit matlab requires x86 codecs.
when use videowriter.audiocompressor = ' % <tab> key
suever mentioned,
when tried same code using 32 bit version of matlab (r2013b), got following list:
- ac-3 acm codec
- ac-3 acm extensible
- ccitt a-law
- ccitt u-law
- gsm 6.10
- ima adpcm
- microsoft adpcm
- none (uncompressed)
note: video codecs shown in 64 bit version, not displayed in 32 bit matlab.
guess displaying video codecs in audiocompressor
matlab bug.
just record, tried <tab> key
before suever posed answer.
read in matlab documentation: http://www.mathworks.com/help/vision/ref/vision.videofilewriter-class.html
to launch tab completion functionality, type following open quote.
y.videocompressor='
a list of compressors available on system appear after press tab key
the following code sample works in system:
video = 'xylophone.mpg'; v = videoreader(video); videofreader = vision.videofilereader(video); videofwriter = vision.videofilewriter('framerate',v.framerate,'audioinputport',1,'videocompressor', 'mjpeg compressor','audiocompressor', 'none (uncompressed)'); [audio,fs] = audioread(video); op=floor(fs/v.framerate); nframes = 0; while ~isdone(videofreader) nframes=nframes+1; frame=step(videofreader); audios=audio( (nframes-1)*op + 1 : min(nframes*op, length(audio)) , : ); %handle last audio sample. if (length(audios) < op) audios = [audios; audios(1:op - length(audios), :)]; end step(videofwriter,frame,audios); end release(videofreader); release(videofwriter);
i searching web free x64 audio codec works matlab, couldn't find one.
Comments
Post a Comment