examples: add video bit-rate control to frame-counter

parent 319d0124
#include <gegl.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
const char *output_path = "frame-counter.ogv";
const char *video_codec = NULL;
int video_bit_rate = 0;
int video_bit_rate_min = 0;
int video_bit_rate_max = 0;
int bufsize = 0;
float frame_rate = 0.0;
gint
main (gint argc,
gchar **argv)
{
if (argv[1])
output_path = argv[1];
int c;
for (c = 1; argv[c]; c++)
{
if (!strcmp (argv[c], "--bufsize"))
bufsize = atoi(argv[++c]);
else if (!strcmp (argv[c], "--video_bit_rate_max"))
video_bit_rate_max = atoi(argv[++c]);
else if (!strcmp (argv[c], "--video_bit_rate_min"))
video_bit_rate_min = atoi(argv[++c]);
else if (!strcmp (argv[c], "--video-bit-rate"))
video_bit_rate = atoi(argv[++c]);
else if (!strcmp (argv[c], "--fps"))
frame_rate = g_strtod (argv[++c], NULL);
else if (!strcmp (argv[c], "--video-codec"))
video_codec = argv[++c];
else
output_path = argv[c];
}
gegl_init (&argc, &argv); /* initialize the GEGL library */
{
......@@ -16,7 +41,6 @@ main (gint argc,
GeglNode *store = gegl_node_new_child (gegl,
"operation", "gegl:ff-save",
"path", output_path,
"frame-rate", 30.0,
NULL);
GeglNode *crop = gegl_node_new_child (gegl,
"operation", "gegl:crop",
......@@ -36,12 +60,23 @@ main (gint argc,
"value", gegl_color_new ("rgb(0.1,0.2,0.3)"),
NULL);
if (frame_rate)
gegl_node_set (store, "frame-rate", frame_rate, NULL);
if (bufsize)
gegl_node_set (store, "bufsize", bufsize, NULL);
if (video_bit_rate)
gegl_node_set (store, "video-bit-rate", video_bit_rate, NULL);
if (video_bit_rate_min)
gegl_node_set (store, "video-bit-rate-min", video_bit_rate_min, NULL);
if (video_bit_rate_max)
gegl_node_set (store, "video-bit-rate-max", video_bit_rate_max, NULL);
gegl_node_link_many (bg, over, crop, store, NULL);
gegl_node_connect_to (text, "output", over, "aux");
{
gint frame;
gint frames = 400;
gint frames = 200;
for (frame=0; frame < frames; frame++)
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment