[gegl/video-rejuvenation: 49/60] ff-save: low bitrate .ogv saving works



commit 914c291ee9ccc04d51297bd2e6647794a2045628
Author: Øyvind Kolås <pippin gimp org>
Date:   Sat Nov 7 02:43:58 2015 +0100

    ff-save: low bitrate .ogv saving works

 configure.ac                  |    2 +-
 examples/hello-world.c        |    2 +-
 operations/external/ff-save.c |   19 ++++++++++++-------
 3 files changed, 14 insertions(+), 9 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 9f94e81..2e16dbb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1013,7 +1013,7 @@ AC_SUBST(LUA_LIBS)
 AC_ARG_WITH(libavformat,  [  --without-libavformat   build without libavformat support])
 
 if test "x$with_libavformat" != xno; then
-  PKG_CHECK_MODULES(AVFORMAT, libavformat >= 53.0.0 libavcodec >= 53.0.0,
+  PKG_CHECK_MODULES(AVFORMAT, libavformat >= 53.0.0 libavcodec >= 53.0.0 libswscale >= 3.1.0,
     have_libavformat="yes",
     have_libavformat="no  (libavformat not found)")
   # verify the presence of the avformat.h header
diff --git a/examples/hello-world.c b/examples/hello-world.c
index a5d162b..9890287 100644
--- a/examples/hello-world.c
+++ b/examples/hello-world.c
@@ -45,7 +45,7 @@ This is the graph we're going to construct:
 */
 
     /*< The image nodes representing operations we want to perform */
-    GeglNode *display    = gegl_node_create_child (gegl, "gegl:display");
+    GeglNode *display    = gegl_node_create_child (gegl, "gegl:ff-save");
     GeglNode *crop       = gegl_node_new_child (gegl,
                                  "operation", "gegl:crop",
                                  "width", 512.0,
diff --git a/operations/external/ff-save.c b/operations/external/ff-save.c
index 6597e26..e8383c1 100644
--- a/operations/external/ff-save.c
+++ b/operations/external/ff-save.c
@@ -27,7 +27,7 @@
 
 #ifdef GEGL_PROPERTIES
 
-property_string (path, _("File"), "/tmp/fnord.mp4")
+property_string (path, _("File"), "/tmp/fnord.ogv")
     description (_("Target path and filename, use '-' for stdout."))
 
 property_double (bitrate, _("Target bitrate"), 800000.0)
@@ -639,6 +639,11 @@ fill_yuv_image (GeglProperties *op,
           op->input_pad[0]->width * op->input_pad[0]->height * 3);*/
   GeglRectangle rect={0,0,width,height};
   gegl_buffer_get (p->input, &rect, 1.0, babl_format ("R'G'B' u8"), pict->data[0], GEGL_AUTO_ROWSTRIDE, 
GEGL_ABYSS_NONE);
+#if 0
+  pict->width = width;
+  pict->height = height;
+  pict->format = PIX_FMT_RGB24;
+#endif
 }
 
 static void
@@ -655,14 +660,11 @@ write_video_frame (GeglProperties *op,
   if (c->pix_fmt != PIX_FMT_RGB24)
     {
       struct SwsContext *img_convert_ctx;
-
-      /* as we only generate a RGB24 picture, we must convert it
-         to the codec pixel format if needed */
       fill_yuv_image (op, p->tmp_picture, p->frame_count, c->width,
                       c->height);
 
-      img_convert_ctx = sws_getContext(c->width, c->height, c->pix_fmt,
-                                       c->width, c->height, PIX_FMT_RGB24,
+      img_convert_ctx = sws_getContext(c->width, c->height, PIX_FMT_RGB24,
+                                       c->width, c->height, c->pix_fmt,
                                        SWS_BICUBIC, NULL, NULL, NULL);
 
       if (img_convert_ctx == NULL)
@@ -672,12 +674,15 @@ write_video_frame (GeglProperties *op,
       else
         {
           sws_scale(img_convert_ctx,
-                    (void*) p->tmp_picture->data,
+                    p->tmp_picture->data,
                     p->tmp_picture->linesize,
                     0,
                     c->height,
                     p->picture->data,
                     p->picture->linesize);
+         p->picture->format = c->pix_fmt;
+         p->picture->width = c->width;
+         p->picture->height = c->height;
         }
     }
   else


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]