[Ffmpeg-devel] [PATCH] let ffplay can play more pixel format
Limin Wang
lance.lmwang
Wed Feb 14 12:13:45 CET 2007
Hi there,
It's very useful to preview the raw video by ffplay I think. The patch
will support ffplay to play yuv422p, yuv444p, etc instead of yuv420 only.
Please review it.
* How to test it:
lmwang at laptop:~/yuvad/open/h264/x264$ ./x264 --progress --frames 100 -o
/tmp/foremean_cif.h264 /home/lmwang/download/test_sequence/foreman_cif.yuv
352x288
lmwang at laptop:~/yuvad/open/h264/ffmpeg$ ./ffmpeg -i /tmp/foreman_cif.h264
-pix_fmt yuv422p /tmp/2.yuv
lmwang at laptop:~/yuvad/open/h264/ffmpeg$ ./ffplay -x 352 -y 288 -pix_fmt
yuv422p /tmp/2.yuv
In addition, how about to add -pix_fmt help option for ffmpeg and ffplay? It's
very crazy to find out what's the pixel format name from the code.
Thanks,
Limin
-------------- next part --------------
Index: ffplay.c
===================================================================
--- ffplay.c (revision 7961)
+++ ffplay.c (working copy)
@@ -186,6 +186,7 @@
static int fs_screen_height;
static int screen_width = 0;
static int screen_height = 0;
+static enum PixelFormat frame_pix_fmt = PIX_FMT_NONE;
static int audio_disable;
static int video_disable;
static int wanted_audio_stream= 0;
@@ -1869,7 +1870,8 @@
ap->width = screen_width;
ap->height= screen_height;
ap->time_base= (AVRational){1, 25};
-
+ ap->pix_fmt = frame_pix_fmt;
+
err = av_open_input_file(&ic, is->filename, is->iformat, 0, ap);
if (err < 0) {
print_error(is->filename, err);
@@ -2362,6 +2364,11 @@
}
}
+static void opt_frame_pix_fmt(const char *arg)
+{
+ frame_pix_fmt = avcodec_get_pix_fmt(arg);
+}
+
#ifdef CONFIG_NETWORK
void opt_rtp_tcp(void)
{
@@ -2418,6 +2425,7 @@
{ "bytes", OPT_BOOL, {(void*)&seek_by_bytes}, "seek by bytes" },
{ "nodisp", OPT_BOOL, {(void*)&display_disable}, "disable graphical display" },
{ "f", HAS_ARG, {(void*)opt_format}, "force format", "fmt" },
+ { "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO, {(void*)opt_frame_pix_fmt}, "set pixel format", "format" },
{ "stats", OPT_BOOL | OPT_EXPERT, {(void*)&show_status}, "show status", "" },
{ "debug", HAS_ARG | OPT_EXPERT, {(void*)opt_debug}, "print specific debug info", "" },
{ "bug", OPT_INT | HAS_ARG | OPT_EXPERT, {(void*)&workaround_bugs}, "workaround bugs", "" },
More information about the ffmpeg-devel
mailing list