Generating video for iDevices / Quicktime programmatically

kootsoop kootsoop at gmail.com
Fri Aug 14 06:29:55 PDT 2015


I'm trying to generate video for iPhones and iPads.  I was able to do this
successfully from the command line, but I need to do some funkiness with my
own plugins and want to figure out how to do this programmatically.

On the command line, if I do this:

/gst-launch multifilesrc location="start/blank/frame%03d.png" index=1
caps="image/png,framerate=\(fraction\)30/1" ! pngdec ! queue !
ffmpegcolorspace ! videorate ! textoverlay text="Hello out there"
font-desc="Roboto-Italic 40" ! x264enc ! mp4mux ! filesink
location="test.mp4"
/

then the "test.mp4" file plays fine on an iPhone (serving it out from
Apache).

However, if I use  this example
<http://cgit.freedesktop.org/gstreamer/gst-plugins-good/tree/tests/examples/cairo/cairo_overlay.c>   
as a base, and change the /setup_gst_pipeline/ method to as pasted below
then it generates "test.mp4" that plays just fine (again when served out via
Apache) in Chrome on my MBP, but doesn't play on iDevices nor does it play
in QuickTime on the MBP.

If it matters, my operating system for generating the video and serving out
the resulting video files is Ubuntu 14.04.3 LTS.  My "viewing" machine is a
MBP.
 
Any pointers to examples about how to encode for display on iDevices /
Quicktime appreciated!


/static GstElement *
setup_gst_pipeline (CairoOverlayState * overlay_state)
{
  GstElement *pipeline;
  GstElement *cairo_overlay;
  GstElement *source, *adaptor1, *adaptor2, *sink, *h264enc, *mp4mux;

  pipeline = gst_pipeline_new ("cairo-overlay-example");

  /* Adaptors needed because cairooverlay only supports ARGB data */
  source = gst_element_factory_make ("videotestsrc", "source");
  g_object_set(G_OBJECT(source), "num-buffers", 1000, NULL);

  GstElement *capsfilter_1 =
gst_element_factory_make("capsfilter","cfilter");
 
g_object_set(G_OBJECT(capsfilter_1),"caps",gst_caps_new_simple("video/x-raw",
    "format", G_TYPE_STRING, "I420",
    "width",G_TYPE_INT,640,
    "height",G_TYPE_INT,480,
    "framerate", GST_TYPE_FRACTION, 30,1,
    "profile", G_TYPE_STRING, "high",
    NULL),
    NULL);

  adaptor1 = gst_element_factory_make ("videoconvert", "adaptor1");
  cairo_overlay = gst_element_factory_make ("cairooverlay", "overlay");
  adaptor2 = gst_element_factory_make ("videoconvert", "adaptor2");

  h264enc = gst_element_factory_make ("x264enc", "ht264enc" );
  g_object_set(G_OBJECT(h264enc),
    "bitrate", 500,
    NULL);


  mp4mux = gst_element_factory_make ("mp4mux", "mp4mux" );
  //mp4mux = gst_element_factory_make ("ffmux_mp4", "mp4mux" );
  //mp4mux = gst_element_factory_make ("qtmux", "mp4mux" );

  //sink = gst_element_factory_make ("ximagesink", "sink");
  //if (sink == NULL)
  sink = gst_element_factory_make ("filesink", "sink");
  g_object_set(G_OBJECT(sink), "location", "test.mp4", NULL);

  /* If failing, the element could not be created */
  g_assert (cairo_overlay);

  /* Hook up the neccesary signals for cairooverlay */
  g_signal_connect (cairo_overlay, "draw", G_CALLBACK (draw_overlay),
overlay_state);
  g_signal_connect (cairo_overlay, "caps-changed", G_CALLBACK
(prepare_overlay), overlay_state);

  gst_bin_add_many (GST_BIN (pipeline), source, capsfilter_1, adaptor1,
cairo_overlay, adaptor2, h264enc, mp4mux, sink, NULL);

  if (!gst_element_link_many (source, capsfilter_1, adaptor1, cairo_overlay,
adaptor2, h264enc, mp4mux, sink, NULL))
  {
    g_warning ("Failed to link elements!");
  }

  return pipeline;
}/




--
View this message in context: http://gstreamer-devel.966125.n4.nabble.com/Generating-video-for-iDevices-Quicktime-programmatically-tp4673165.html
Sent from the GStreamer-devel mailing list archive at Nabble.com.


More information about the gstreamer-devel mailing list