Matlab (R2015a、Windows7) で Computer Vision System Toolbox を使用して、ビデオ ファイルのフレームをマスクし、新しいビデオ ファイルに書き込みます。マスキングによって、画像の約 80% を 0 と 1 に置き換えます。
videoFileReader = vision.VideoFileReader(fin);
videoFileWriter=vision.VideoFileWriter(fout, ...
'FileFormat', 'MPEG4', 'FrameRate', videoFileReader.info.VideoFrameRate);
frame = step(videoFileReader);
frame_new=mask(frame); %user function
step(videoFileWriter, frame_new);
元のフレームと変更されたフレームのサイズ (1080 x 1920 x 3) と形式 (単一) は同じままです。それでも、マスクされたビデオは元のビデオよりもはるかに大きくなります。たとえば、1GB の元のビデオはマスキング後にほぼ 4GB になります。これらの大きな新しいファイルを開くことができません (Windows 7、VLC メディア)。Handbrake はそれらを正当なビデオ ファイルとして認識しません。
画像の約 20% だけをマスクしても、マスクされたビデオはまだ大きくなります (最大 2.5Gb) が、これらを開くのに問題はありません。
「VideoCompressor」、「MJPEG Compressor」を追加してみましたが、警告が出ます。
videoFileWriter=vision.VideoFileWriter(fin, 'FileFormat', 'MPEG4', ...
'FrameRate', videoFileReader.info.VideoFrameRate, 'VideoCompressor', 'MJPEG Compressor');
<...>
Warning: The VideoCompressor property is not relevant in this configuration of the System object.
匿名化する必要のある TB のビデオ データがあるため、ご提案をいただければ幸いです。ありがとう!