examples/write-video.js
function () {
  vid2.read(function (err, m2) {
	if (writer2 === null)
	  writer2 = new cv.VideoWriter(filename2, 'DIVX', vid2.getFPS(), m2.size(), true);

	x++;
	writer2.write(m2, function(err){
	  if (x < 100) {
		iter();
	  } else {
		vid2.release();
		writer2.release();
	  }
	});
	m2.release();
	delete m2;
  });
}
function () {
  vid2.read(function (err, m2) {
	if (writer2 === null)
	  writer2 = new cv.VideoWriter(filename2, 'DIVX', vid2.getFPS(), m2.size(), true);

	x++;
	writer2.write(m2, function(err){
	  if (x < 100) {
		iter();
	  } else {
		vid2.release();
		writer2.release();
	  }
	});
	m2.release();
	delete m2;
  });
}
function ( ) { vid2 . read ( function ( err , m2 ) { if ( writer2 === null ) writer2 = new cv . VideoWriter ( filename2 , 'DIVX' , vid2 . getFPS ( ) , m2 . size ( ) , true ) ; x ++ ; writer2 . write ( m2 , function ( err ) { if ( x < 100 ) { iter ( ) ; } else { vid2 . release ( ) ; writer2 . release ( ) ; } } ) ; m2 . release ( ) ; delete m2 ; } ) ; }
do the same write async
do the same write async