Writing raw frames to mpegts [SEC=UNCLASSIFIED]
Durrand, Paul (Contractor)
Paul.Durrand at dsto.defence.gov.au
Sun Jul 31 23:18:56 PDT 2011
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[0
0m 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20110801/b4ff0ff9/attachment.html>
More information about the gstreamer-devel
mailing list