summaryrefslogtreecommitdiff
path: root/ffmpeg.c
diff options
context:
space:
mode:
authorRoman Shaposhnik <roman@shaposhnik.org>2003-05-07 19:01:45 +0000
committerRoman Shaposhnik <roman@shaposhnik.org>2003-05-07 19:01:45 +0000
commit631670888d4ff9ca08c9d0804082511a1bc587a5 (patch)
tree2bf2601c9204d6d3097f93cda618a25eb0d4bb74 /ffmpeg.c
parent4e80eb21afd02747592e9fb9cfe2679401b7857e (diff)
* introducing new public interface in imgconvert.c
+ avcodec_get_pix_fmt converts textual representation of pixel format into the actual id. Complements avcodec_get_pix_fmt_name. + avpicture_layout serializes given picture into a flat array. Complements avpicture_fill. * adding a new option -pix_fmt to the ffmpeg, in order to control pixel format for the codecs that do support it, like rawvideo, for example. * reducing complexity of the rawvideo codec by splitting it in two and making it more reliable via hooking up to the avpicture_layout. Plus adding new FourCC as described here: http://www.fourcc.org * A tiny fix for avienc.c that makes avih and video strf consistent regarding codec FourCC. Originally committed as revision 1842 to svn://svn.ffmpeg.org/ffmpeg/trunk
Diffstat (limited to 'ffmpeg.c')
-rw-r--r--ffmpeg.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/ffmpeg.c b/ffmpeg.c
index e7f9c1cc77..e4bf8e6eef 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -89,6 +89,7 @@ static AVImageFormat *image_format;
static int frame_width = 160;
static int frame_height = 128;
static float frame_aspect_ratio = 0;
+static enum PixelFormat frame_pix_fmt = PIX_FMT_YUV420P;
static int frame_topBand = 0;
static int frame_bottomBand = 0;
static int frame_leftBand = 0;
@@ -1706,6 +1707,11 @@ static void opt_frame_size(const char *arg)
}
}
+static void opt_frame_pix_fmt(const char *arg)
+{
+ frame_pix_fmt = avcodec_get_pix_fmt(arg);
+}
+
static void opt_frame_aspect_ratio(const char *arg)
{
int x = 0, y = 0;
@@ -2032,6 +2038,7 @@ static void opt_input_file(const char *filename)
ap->width = frame_width;
ap->height = frame_height;
ap->image_format = image_format;
+ ap->pix_fmt = frame_pix_fmt;
/* open the input file with generic libav function */
err = av_open_input_file(&ic, filename, file_iformat, 0, ap);
@@ -2061,6 +2068,7 @@ static void opt_input_file(const char *filename)
frame_height = enc->height;
frame_width = enc->width;
frame_aspect_ratio = enc->aspect_ratio;
+ frame_pix_fmt = enc->pix_fmt;
rfps = ic->streams[i]->r_frame_rate;
rfps_base = ic->streams[i]->r_frame_rate_base;
enc->workaround_bugs = workaround_bugs;
@@ -2218,6 +2226,7 @@ static void opt_output_file(const char *filename)
video_enc->width = frame_width;
video_enc->height = frame_height;
video_enc->aspect_ratio = frame_aspect_ratio;
+ video_enc->pix_fmt = frame_pix_fmt;
if (!intra_only)
video_enc->gop_size = gop_size;
@@ -2722,6 +2731,7 @@ const OptionDef options[] = {
{ "re", OPT_BOOL|OPT_EXPERT, {(void*)&rate_emu}, "read input at native frame rate" },
{ "s", HAS_ARG, {(void*)opt_frame_size}, "set frame size (WxH or abbreviation)", "size" },
{ "aspect", HAS_ARG, {(void*)opt_frame_aspect_ratio}, "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" },
+ { "pix_fmt", HAS_ARG | OPT_EXPERT, {(void*)opt_frame_pix_fmt}, "set pixel format", "format" },
{ "croptop", HAS_ARG, {(void*)opt_frame_crop_top}, "set top crop band size (in pixels)", "size" },
{ "cropbottom", HAS_ARG, {(void*)opt_frame_crop_bottom}, "set bottom crop band size (in pixels)", "size" },
{ "cropleft", HAS_ARG, {(void*)opt_frame_crop_left}, "set left crop band size (in pixels)", "size" },