Hi,
Just following up on some discussion on IRC about CinV3 options, here's
a hypothetical example based on the concept of 'libcinelerra', the main
video editing engine, on top of which any gui is very thin and very
cleanly separated.
Cheers
David
------------
$ gcc -c myprog.c
$ gcc -o myprog myprog.c -lcinelerra
$ cat myprog.c
/*
* myprog.c - sample Cinelerra client app for converting an arbitrary
* video to .mov format, and de-noising the video along the way
*/
#include <stdlib.h>
#include <stdio.h>
#include <cinelerra.h>
#include <cinelerra/plugin.h>
int main(int argc, char *argv[])
{
CinProject *cin;
CinTimeline *timeline;
CinVideoTrack *vidTrk;
CinStereoAudioTrack *audTrk;
CinClip *videoIn;
CinPlugin *denoiser;
CinRenderConfig *render;
int err;
// get a cin project
if ((cin = cinProjectCreate()) == NULL) {
fprintf(stderr, "Failed to create cinelerra project\n");
exit(1);
}
// set it up for standard PAL
cinProjectSetProperty(CIN_FORMAT, CIN_FMT_PAL);
// create tracks which inherit properties from project
vidTrk = cinProjectAppendVideoTrack(cin, "myvideo");
audTrk = cinProjectAppendAudioTrack(cin, "myaudio", 2);
// load video to convert
if ((videoIn = cinProjectLoadResource(cin, argv[1])) == NULL) {
fprintf(stderr, "Failed to load video %s\n", argv[1]);
exit(1);
}
// place video on timeline, 1.0 seconds from start
cinTimelineAddClip(cin->timeline, videoIn, vidTrk, audTrk, 1.0);
// add video denoiser effect
if ((denoiser = cinTrackAppendPlugin(vidTrk,"vdenoise")) == NULL) {
fprintf(stderr, "Failed to load video denoiser\n");
exit(1);
}
// and set it so it spans the entire video clip
cinPluginSetProperty(denoiser, CIN_PLUGIN_START, vidTrk->begin);
cinPluginSetProperyt(denoiser, CIN_PLUGIN_END, vidTrk->end);
// set up render command structure
render.file = "out.mov";
render.container = CIN_CONTAINER_MOV;
render.vcodec = CIN_VCODEC_MPEG4;
render.fps = 25;
render.vbw = 2000; // kbits/sec
render.acodec = CIN_ACODEC_MP3;
render.arate = 44100;
render.abw = 256; // 256kbits/sec
// now do the render
if ((err = cinProjectRender(cin, &render)) != 0) {
fprintf(stderr, "Failed to render\n");
exit(1);
}
// success
return 0;
}
_______________________________________________
Cinelerra mailing list
[email protected]
https://init.linpro.no/mailman/skolelinux.no/listinfo/cinelerra