changeset 605:3875bb31cc10

And here's the function that run ffmpeg to make the movie from PNGs.
author dicklyon@google.com
date Thu, 09 May 2013 04:00:25 +0000
parents ec3a1c74ec54
children 03c642677954
files matlab/bmm/carfac/MakeMovieFromPngsAndWav.m
diffstat 1 files changed, 36 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/matlab/bmm/carfac/MakeMovieFromPngsAndWav.m	Thu May 09 04:00:25 2013 +0000
@@ -0,0 +1,36 @@
+% Copyright 2013, Google, Inc.
+% Author: Richard F. Lyon
+%
+% This Matlab file is part of an implementation of Lyon's cochlear model:
+% "Cascade of Asymmetric Resonators with Fast-Acting Compression"
+% to supplement Lyon's upcoming book "Human and Machine Hearing"
+%
+% Licensed under the Apache License, Version 2.0 (the "License");
+% you may not use this file except in compliance with the License.
+% You may obtain a copy of the License at
+%
+%     http://www.apache.org/licenses/LICENSE-2.0
+%
+% Unless required by applicable law or agreed to in writing, software
+% distributed under the License is distributed on an "AS IS" BASIS,
+% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+% See the License for the specific language governing permissions and
+% limitations under the License.
+
+function MakeMovieFromPngsAndWav(frame_rate, png_name_pattern, ...
+  wav_filename, out_filename)
+
+system(['rm ', out_filename]);
+
+if ~exist(wav_filename, 'file')
+  error('wave file is missing', wav_filename)
+end
+
+ffmpeg_command = ['/opt/local/bin/ffmpeg' ...
+  ' -r ' num2str(frame_rate) ...
+  ' -i ' png_name_pattern ...
+  ' -i ' wav_filename ...
+  ' -b:v 1024k' ...
+  ' ' out_filename];
+
+system(ffmpeg_command);