Effacer les filtres
Effacer les filtres

Error: vision.Vid​eoFileWrit​er/step Too many input arguments. Expected 1 (in addition to System object), got 2.

1 vue (au cours des 30 derniers jours)
I get this error when trying to create a '.mp4 file' using the appended code.
Warning: The AudioInputPort property is not relevant in this
configuration of the System object.
Error using vision.VideoFileWriter/step
Too many input arguments. Expected 1 (in addition to System object), got 2.
Error in Audio_combine_evening (line 50)
step(writerObj, img, parsedAudio);
The code is appended below; it worked perfectly well in creation of a '.avi' file.
[data, freq] = audioread('EC.wav'); % Reading the audio file
img = imread('Image.png'); % Reading the image file
audioLength = length(data)/freq;% duration of audio file
writerObj = vision.VideoFileWriter('Filename','newvideo.avi','AudioInputPort',true,'FrameRate', 1); % for .avi file
% writerObj = vision.VideoFileWriter('Filename','newvideo.mp4','FileFormat','MPEG4','AudioInputPort',true,'FrameRate', 1); % for .mp4 file
for i = 1:audioLength
parsedAudio = data((i-1)*length(data)/audioLength + 1:i*length(data)/audioLength);%parsing the audio into equally sized pieces (play for 1 sec)
step(writerObj, img, parsedAudio);
end
release(writerObj);

Réponse acceptée

Walter Roberson
Walter Roberson le 18 Juil 2021
writerObj = vision.VideoFileWriter('newvideo.avi','AudioInputPort',true,'FrameRate', 1); % for .avi file
  3 commentaires
SKP
SKP le 18 Juil 2021
Thank you for answering.
Is there a way within MATLAB to combine (i) an image file and (ii) an audio file to get a (iii) .mp4 file or should I resort to some other software for converting the generated .avi file to .mp4
Walter Roberson
Walter Roberson le 18 Juil 2021
However, the documentation says MPEG is supported for Windows 7 and MacOS. It is not obvious at the moment whether "Windows 7" excludes Windows 8 and Windows 10.

Connectez-vous pour commenter.

Plus de réponses (0)

Catégories

En savoir plus sur Computer Vision Toolbox dans Help Center et File Exchange

Produits


Version

R2020b

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by