есть сишный код:
/* Output the frame count times */
if (lav_write_frame(settings->video_file,buff,size,count))
{
/* If an error happened, try to close output files and exit */
lavrec_msg(LAVREC_MSG_ERROR, info,
"Error writing to output file %s: %s", settings->stats->output_filename, lav_strerror());
lavrec_close_files_on_error(info);
return 0;
}
/* Update counters. Maybe frame its written only once,
* but size*count is the save guess
*/
settings->bytes_output_cur += size*count;
// settings->stats->num_frames += count;
while (count-- > 0) {
if (settings->stats->num_frames++ % 10 == 0) {
lav_file_t *jpg_file;
jpg_file = lav_open_output_file("/tmp/file.jpg", 'j',
settings->width, settings->height,Y4M_ILACE_NONE,
(info->video_norm==1? 30000.0/1001.0 : 25.0), 0, 0, 0);
lav_write_frame(jpg_file, buff, size, 1);
lav_close (jpg_file);
}
}
/*
* If the user has specified flushing of file buffers
* flush every time the specified number of unflushed frames has
* been reached.
*/
надо в цикле while (count-- > 0) сделать суммирование при помощи внешней команды system(convert file1.jpg file.jpg -average summ.jpg)
вопрос, как вызывать из кода system и как нумеровать предыдущий и слдующий снимок. На перле как - знаю (чтото типа каунтера на деление пополам), но тут скорости важны, т.к. оцифровка видео идет в реальном режиме. Где чего почитать можно по этому поводу??
Спасибо!