summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNicolas George <nicolas.george@normalesup.org>2012-08-09 11:51:45 +0200
committerNicolas George <nicolas.george@normalesup.org>2012-08-14 11:17:45 +0200
commite4f4d99df829d957f8f5541a3665d6631bdf94ca (patch)
tree699803abbba49db60e68a656b16a7c91f2d46ac8
parent17e40236cb36ed27632159b2821ce0c42dc301e9 (diff)
downloadffmpeg-streaming-e4f4d99df829d957f8f5541a3665d6631bdf94ca.zip
ffmpeg-streaming-e4f4d99df829d957f8f5541a3665d6631bdf94ca.tar.gz
ffmpeg: make -s work for subtitles too.
Some codecs allow to encode the frame size and some players use it.
-rw-r--r--ffmpeg_opt.c12
1 files changed, 11 insertions, 1 deletions
diff --git a/ffmpeg_opt.c b/ffmpeg_opt.c
index ac72b45..66cffe2 100644
--- a/ffmpeg_opt.c
+++ b/ffmpeg_opt.c
@@ -1218,6 +1218,16 @@ static OutputStream *new_subtitle_stream(OptionsContext *o, AVFormatContext *oc,
MATCH_PER_STREAM_OPT(copy_initial_nonkeyframes, i, ost->copy_initial_nonkeyframes, oc, st);
+ if (!ost->stream_copy) {
+ char *frame_size = NULL;
+
+ MATCH_PER_STREAM_OPT(frame_sizes, str, frame_size, oc, st);
+ if (frame_size && av_parse_video_size(&subtitle_enc->width, &subtitle_enc->height, frame_size) < 0) {
+ av_log(NULL, AV_LOG_FATAL, "Invalid frame size: %s.\n", frame_size);
+ exit_program(1);
+ }
+ }
+
return ost;
}
@@ -2219,7 +2229,7 @@ const OptionDef options[] = {
/* video options */
{ "vframes", HAS_ARG | OPT_VIDEO | OPT_FUNC2, {(void*)opt_video_frames}, "set the number of video frames to record", "number" },
{ "r", HAS_ARG | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(frame_rates)}, "set frame rate (Hz value, fraction or abbreviation)", "rate" },
- { "s", HAS_ARG | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(frame_sizes)}, "set frame size (WxH or abbreviation)", "size" },
+ { "s", HAS_ARG | OPT_VIDEO | OPT_SUBTITLE | OPT_STRING | OPT_SPEC, {.off = OFFSET(frame_sizes)}, "set frame size (WxH or abbreviation)", "size" },
{ "aspect", HAS_ARG | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(frame_aspect_ratios)}, "set aspect ratio (4:3, 16:9 or 1.3333, 1.7777)", "aspect" },
{ "pix_fmt", HAS_ARG | OPT_EXPERT | OPT_VIDEO | OPT_STRING | OPT_SPEC, {.off = OFFSET(frame_pix_fmts)}, "set pixel format", "format" },
{ "bits_per_raw_sample", OPT_INT | HAS_ARG | OPT_VIDEO, {(void*)&frame_bits_per_raw_sample}, "set the number of bits per raw sample", "number" },
OpenPOWER on IntegriCloud