Writing raw frames to mpegts [SEC=UNCLASSIFIED]

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Writing raw frames to mpegts [SEC=UNCLASSIFIED]

Durrand, Paul (Contractor)

UNCLASSIFIED

Hi,
 
I am currently trying to develop an application which utilises GStreamer to write and YUV format mpegts file. The driver uses appsrc to write raw RGB frames to a YUV mpegts file.
 
I am trying to get a pipeline together and as I'm new to GStreamer I am not quite sure which plugins and caps to set.I was hoping someone can point me in the right direction.
 
With the pipeline: "appsrc name=\"adsssrc\" caps=\"video/x-raw-rgb,width=704,height=480,framerate=(fraction)25/1\" ! ffmpegcolorspace ! video/x-raw-yuv ! ffenc_mpeg2video ! mpegtsmux ! filesink location=processed.mpg " I get the following errors:
 0:00:00.107419734 ESC[332m28183ESC[00m      0x2556010 ESC[32;01mINFO   ESC[00m ESC[00;01;31m          GST_STATES gstbin.c:2425:gst_bin_change_state_func:<bin0>ESC[00m child 'adsssrc' changed state to 3(PAUSED) successfully
0:00:00.140944498 ESC[332m28183ESC[00m      0x2758f90 ESC[33;01mWARN   ESC[00m ESC[00m       basetransform gstbasetransform.c:1047:gst_base_transform_acceptcaps:<capsfilter0>ESC[00m transform could not transform video/x-raw-rgb, width=(int)704, height=(int)480, framerate=(fraction)25/1 in anything we support
0:00:00.141210658 ESC[332m28183ESC[00m      0x2758f90 ESC[33;01mWARN   ESC[00m ESC[00m       basetransform gstbasetransform.c:1144:gst_base_transform_setcaps:<ffmpegcsp0>ESC[00m FAILED to configure caps <ffmpegcsp0:src> to accept video/x-raw-yuv, width=(int)704, height=(int)480, framerate=(fraction)25/1, format=(fourcc)I420
0:00:00.141441378 ESC[332m28183ESC[00m      0x2758f90 ESC[32;01mINFO   ESC[00m ESC[00m             basesrc gstbasesrc.c:2447:gst_base_src_loop:<adsssrc>ESC[00m pausing after gst_pad_push() = not-negotiated
My test source is below:
 
#include <stdlib.h>
#include <glib.h>
#include <gst/gst.h>
#include <gst/app/gstappsink.h>
#include <gst/app/gstappsrc.h>
#include <gst/app/gstappbuffer.h>
 

int main(void)
{
 
  const int width=704;
  const int height=480;
  const int numFrames=50;
  const int layers=3;
 
  char *fullPipelineDesc = "appsrc name=\"adsssrc\" caps=\"video/x-raw-rgb,width=704,height=480,framerate=(fraction)25/1\" ! ffmpegcolorspace ! video/x-raw-yuv ! ffenc_mpeg2video ! mpegtsmux ! filesink location=processed.mpg ";
  GstElement *writePipeline;
  GError     *error     = NULL;
  GstAppSrc *appsrc    = NULL;
  GstBuffer *app_buffer;
  unsigned char *outByte;
  unsigned char *outBuff;
  int outBuffSize = width * height * layers;
  int count=0;
 
  outBuff = calloc(outBuffSize, sizeof(unsigned char));
 

  gst_init(NULL, NULL);
  gst_debug_set_default_threshold(GST_LEVEL_INFO);
 
  writePipeline = gst_parse_bin_from_description(fullPipelineDesc, FALSE, &error);
  appsrc = (GstAppSrc *) gst_bin_get_by_name(GST_BIN(writePipeline), "adsssrc");
  gst_element_set_state(writePipeline, GST_STATE_PLAYING);
 
  /******** WRITE SOME RGB DATA INTO A BUFFER *******/
  for (int frame=0; frame<numFrames; frame++)
  {
     count = 0;
     for (int row=0; row<height; row++)
     {
        for (int plane=0; plane<layers; plane++)
 {
 
   for (int pixel=0; pixel<width; pixel++)
   {
 fflush(stdout);
      outByte  = outBuff;
      outByte += (row*width*layers) + (pixel*layers) + plane;
 
      if (row%2)
        *outByte = 255;
      else
        *outByte = 0;
 
          }
        }
      }
      app_buffer = gst_app_buffer_new(outBuff, outBuffSize,
                                  g_free, outBuff);
 
      /* Write the buffer to the source pad */
      gst_app_src_push_buffer(GST_APP_SRC(appsrc), app_buffer);
  }
 
  gst_app_src_end_of_stream(appsrc);
 
  free(outBuff);
 
  return 0;
}
 
 
 
 

IMPORTANT: This email remains the property of the Department of Defence and is subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have received this email in error, you are requested to contact the sender and delete the email.


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

RE: Writing raw frames to mpegts [SEC=UNCLASSIFIED]

Durrand, Paul (Contractor)

UNCLASSIFIED

I am making slight progress with this problem. I have fully defined the caps for APPSRC to match those specified as a SINK in ffmpegcolorspace. My new pipeline is (the rest of the source is below in the original email):
 
  char *fullPipelineDesc = "appsrc is-live=true name=\"adsssrc\" caps=\"video/x-raw-rgb,width=704,height=480,framerate=(fraction)25/1,bpp=24,depth=24,red_mask=255,green_mask=65280,blue_mask=16711680,endianness=4321\" ! ffmpegcolorspace ! video/x-raw-yuv,width=704,height=480,framerate=(fraction)25/1,format=(fourcc)I420 ! ffenc_mpeg2video ! mpegtsmux ! filesink location=processed.mpg ";
 
With this I see the following error:
 
  basetransform gstbasetransform.c:1047:gst_base_transform_acceptcaps:<capsfilter0>ESC[00m transform could not transform video/x-raw-rgb, width=(int)704, height=(int)480, framerate=(fraction)25/1, bpp=(int)24, depth=(int)24, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, endianness=(int)4321 in anything we support
This puzzles me as the both the sink and src capabilities match the output I see from "gst-inspect-0.10 ffmpegcolorspace". Am I missing something?
 
Thanks,
Paul
 

IMPORTANT: This email remains the property of the Department of Defence and is subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have received this email in error, you are requested to contact the sender and delete the email.


From: Durrand, Paul (Contractor)
Sent: Monday, 1 August 2011 3:49 PM
To: 'Discussion of the development of and with GStreamer'
Subject: Writing raw frames to mpegts [SEC=UNCLASSIFIED]

UNCLASSIFIED

Hi,
 
I am currently trying to develop an application which utilises GStreamer to write and YUV format mpegts file. The driver uses appsrc to write raw RGB frames to a YUV mpegts file.
 
I am trying to get a pipeline together and as I'm new to GStreamer I am not quite sure which plugins and caps to set.I was hoping someone can point me in the right direction.
 
With the pipeline: "appsrc name=\"adsssrc\" caps=\"video/x-raw-rgb,width=704,height=480,framerate=(fraction)25/1\" ! ffmpegcolorspace ! video/x-raw-yuv ! ffenc_mpeg2video ! mpegtsmux ! filesink location=processed.mpg " I get the following errors:
 0:00:00.107419734 ESC[332m28183ESC[00m      0x2556010 ESC[32;01mINFO   ESC[00m ESC[00;01;31m          GST_STATES gstbin.c:2425:gst_bin_change_state_func:<bin0>ESC[00m child 'adsssrc' changed state to 3(PAUSED) successfully
0:00:00.140944498 ESC[332m28183ESC[00m      0x2758f90 ESC[33;01mWARN   ESC[00m ESC[00m       basetransform gstbasetransform.c:1047:gst_base_transform_acceptcaps:<capsfilter0>ESC[00m transform could not transform video/x-raw-rgb, width=(int)704, height=(int)480, framerate=(fraction)25/1 in anything we support
0:00:00.141210658 ESC[332m28183ESC[00m      0x2758f90 ESC[33;01mWARN   ESC[00m ESC[00m       basetransform gstbasetransform.c:1144:gst_base_transform_setcaps:<ffmpegcsp0>ESC[00m FAILED to configure caps <ffmpegcsp0:src> to accept video/x-raw-yuv, width=(int)704, height=(int)480, framerate=(fraction)25/1, format=(fourcc)I420
0:00:00.141441378 ESC[332m28183ESC[00m      0x2758f90 ESC[32;01mINFO   ESC[00m ESC[00m             basesrc gstbasesrc.c:2447:gst_base_src_loop:<adsssrc>ESC[00m pausing after gst_pad_push() = not-negotiated
My test source is below:
 
#include <stdlib.h>
#include <glib.h>
#include <gst/gst.h>
#include <gst/app/gstappsink.h>
#include <gst/app/gstappsrc.h>
#include <gst/app/gstappbuffer.h>
 

int main(void)
{
 
  const int width=704;
  const int height=480;
  const int numFrames=50;
  const int layers=3;
 
  char *fullPipelineDesc = "appsrc name=\"adsssrc\" caps=\"video/x-raw-rgb,width=704,height=480,framerate=(fraction)25/1\" ! ffmpegcolorspace ! video/x-raw-yuv ! ffenc_mpeg2video ! mpegtsmux ! filesink location=processed.mpg ";
  GstElement *writePipeline;
  GError     *error     = NULL;
  GstAppSrc *appsrc    = NULL;
  GstBuffer *app_buffer;
  unsigned char *outByte;
  unsigned char *outBuff;
  int outBuffSize = width * height * layers;
  int count=0;
 
  outBuff = calloc(outBuffSize, sizeof(unsigned char));
 

  gst_init(NULL, NULL);
  gst_debug_set_default_threshold(GST_LEVEL_INFO);
 
  writePipeline = gst_parse_bin_from_description(fullPipelineDesc, FALSE, &error);
  appsrc = (GstAppSrc *) gst_bin_get_by_name(GST_BIN(writePipeline), "adsssrc");
  gst_element_set_state(writePipeline, GST_STATE_PLAYING);
 
  /******** WRITE SOME RGB DATA INTO A BUFFER *******/
  for (int frame=0; frame<numFrames; frame++)
  {
     count = 0;
     for (int row=0; row<height; row++)
     {
        for (int plane=0; plane<layers; plane++)
 {
 
   for (int pixel=0; pixel<width; pixel++)
   {
 fflush(stdout);
      outByte  = outBuff;
      outByte += (row*width*layers) + (pixel*layers) + plane;
 
      if (row%2)
        *outByte = 255;
      else
        *outByte = 0;
 
          }
        }
      }
      app_buffer = gst_app_buffer_new(outBuff, outBuffSize,
                                  g_free, outBuff);
 
      /* Write the buffer to the source pad */
      gst_app_src_push_buffer(GST_APP_SRC(appsrc), app_buffer);
  }
 
  gst_app_src_end_of_stream(appsrc);
 
  free(outBuff);
 
  return 0;
}
 
 
 
 

IMPORTANT: This email remains the property of the Department of Defence and is subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have received this email in error, you are requested to contact the sender and delete the email.


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel
Reply | Threaded
Open this post in threaded view
|

RE: Writing raw frames to mpegts [SEC=UNCLASSIFIED]

Durrand, Paul (Contractor)

UNCLASSIFIED

I resolved my issue by removing the caps filter after the ffmpegcolorspace. I also added in videorate and I generate an mpegts.
 
The new pipeline is:
 
char *fullPipelineDesc = "appsrc is-live=true name=\"adsssrc\" caps=\"video/x-raw-rgb,width=704,height=480,framerate=(fraction)25/1,bpp=24,depth=24,red_mask=255,green_mask=65280,blue_mask=16711680,endianness=4321\" ! ffmpegcolorspace ! videorate ! ffenc_mpeg2video ! ffmux_mpegts ! filesink location=processed.mpg ";

IMPORTANT: This email remains the property of the Department of Defence and is subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have received this email in error, you are requested to contact the sender and delete the email.


From: Durrand, Paul (Contractor)
Sent: Tuesday, 2 August 2011 2:43 PM
To: 'Discussion of the development of and with GStreamer'
Subject: RE: Writing raw frames to mpegts [SEC=UNCLASSIFIED]

UNCLASSIFIED

I am making slight progress with this problem. I have fully defined the caps for APPSRC to match those specified as a SINK in ffmpegcolorspace. My new pipeline is (the rest of the source is below in the original email):
 
  char *fullPipelineDesc = "appsrc is-live=true name=\"adsssrc\" caps=\"video/x-raw-rgb,width=704,height=480,framerate=(fraction)25/1,bpp=24,depth=24,red_mask=255,green_mask=65280,blue_mask=16711680,endianness=4321\" ! ffmpegcolorspace ! video/x-raw-yuv,width=704,height=480,framerate=(fraction)25/1,format=(fourcc)I420 ! ffenc_mpeg2video ! mpegtsmux ! filesink location=processed.mpg ";
 
With this I see the following error:
 
  basetransform gstbasetransform.c:1047:gst_base_transform_acceptcaps:<capsfilter0>ESC[00m transform could not transform video/x-raw-rgb, width=(int)704, height=(int)480, framerate=(fraction)25/1, bpp=(int)24, depth=(int)24, red_mask=(int)255, green_mask=(int)65280, blue_mask=(int)16711680, endianness=(int)4321 in anything we support
This puzzles me as the both the sink and src capabilities match the output I see from "gst-inspect-0.10 ffmpegcolorspace". Am I missing something?
 
Thanks,
Paul
 

IMPORTANT: This email remains the property of the Department of Defence and is subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have received this email in error, you are requested to contact the sender and delete the email.


From: Durrand, Paul (Contractor)
Sent: Monday, 1 August 2011 3:49 PM
To: 'Discussion of the development of and with GStreamer'
Subject: Writing raw frames to mpegts [SEC=UNCLASSIFIED]

UNCLASSIFIED

Hi,
 
I am currently trying to develop an application which utilises GStreamer to write and YUV format mpegts file. The driver uses appsrc to write raw RGB frames to a YUV mpegts file.
 
I am trying to get a pipeline together and as I'm new to GStreamer I am not quite sure which plugins and caps to set.I was hoping someone can point me in the right direction.
 
With the pipeline: "appsrc name=\"adsssrc\" caps=\"video/x-raw-rgb,width=704,height=480,framerate=(fraction)25/1\" ! ffmpegcolorspace ! video/x-raw-yuv ! ffenc_mpeg2video ! mpegtsmux ! filesink location=processed.mpg " I get the following errors:
 0:00:00.107419734 ESC[332m28183ESC[00m      0x2556010 ESC[32;01mINFO   ESC[00m ESC[00;01;31m          GST_STATES gstbin.c:2425:gst_bin_change_state_func:<bin0>ESC[00m child 'adsssrc' changed state to 3(PAUSED) successfully
0:00:00.140944498 ESC[332m28183ESC[00m      0x2758f90 ESC[33;01mWARN   ESC[00m ESC[00m       basetransform gstbasetransform.c:1047:gst_base_transform_acceptcaps:<capsfilter0>ESC[00m transform could not transform video/x-raw-rgb, width=(int)704, height=(int)480, framerate=(fraction)25/1 in anything we support
0:00:00.141210658 ESC[332m28183ESC[00m      0x2758f90 ESC[33;01mWARN   ESC[00m ESC[00m       basetransform gstbasetransform.c:1144:gst_base_transform_setcaps:<ffmpegcsp0>ESC[00m FAILED to configure caps <ffmpegcsp0:src> to accept video/x-raw-yuv, width=(int)704, height=(int)480, framerate=(fraction)25/1, format=(fourcc)I420
0:00:00.141441378 ESC[332m28183ESC[00m      0x2758f90 ESC[32;01mINFO   ESC[00m ESC[00m             basesrc gstbasesrc.c:2447:gst_base_src_loop:<adsssrc>ESC[00m pausing after gst_pad_push() = not-negotiated
My test source is below:
 
#include <stdlib.h>
#include <glib.h>
#include <gst/gst.h>
#include <gst/app/gstappsink.h>
#include <gst/app/gstappsrc.h>
#include <gst/app/gstappbuffer.h>
 

int main(void)
{
 
  const int width=704;
  const int height=480;
  const int numFrames=50;
  const int layers=3;
 
  char *fullPipelineDesc = "appsrc name=\"adsssrc\" caps=\"video/x-raw-rgb,width=704,height=480,framerate=(fraction)25/1\" ! ffmpegcolorspace ! video/x-raw-yuv ! ffenc_mpeg2video ! mpegtsmux ! filesink location=processed.mpg ";
  GstElement *writePipeline;
  GError     *error     = NULL;
  GstAppSrc *appsrc    = NULL;
  GstBuffer *app_buffer;
  unsigned char *outByte;
  unsigned char *outBuff;
  int outBuffSize = width * height * layers;
  int count=0;
 
  outBuff = calloc(outBuffSize, sizeof(unsigned char));
 

  gst_init(NULL, NULL);
  gst_debug_set_default_threshold(GST_LEVEL_INFO);
 
  writePipeline = gst_parse_bin_from_description(fullPipelineDesc, FALSE, &error);
  appsrc = (GstAppSrc *) gst_bin_get_by_name(GST_BIN(writePipeline), "adsssrc");
  gst_element_set_state(writePipeline, GST_STATE_PLAYING);
 
  /******** WRITE SOME RGB DATA INTO A BUFFER *******/
  for (int frame=0; frame<numFrames; frame++)
  {
     count = 0;
     for (int row=0; row<height; row++)
     {
        for (int plane=0; plane<layers; plane++)
 {
 
   for (int pixel=0; pixel<width; pixel++)
   {
 fflush(stdout);
      outByte  = outBuff;
      outByte += (row*width*layers) + (pixel*layers) + plane;
 
      if (row%2)
        *outByte = 255;
      else
        *outByte = 0;
 
          }
        }
      }
      app_buffer = gst_app_buffer_new(outBuff, outBuffSize,
                                  g_free, outBuff);
 
      /* Write the buffer to the source pad */
      gst_app_src_push_buffer(GST_APP_SRC(appsrc), app_buffer);
  }
 
  gst_app_src_end_of_stream(appsrc);
 
  free(outBuff);
 
  return 0;
}
 
 
 
 

IMPORTANT: This email remains the property of the Department of Defence and is subject to the jurisdiction of section 70 of the Crimes Act 1914. If you have received this email in error, you are requested to contact the sender and delete the email.


_______________________________________________
gstreamer-devel mailing list
[hidden email]
http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel