10 Feb 13:32
[PATCH] Allow multi-pass encoding with libx264 for multi-video output files
Tudor SUCIU <tudor.suciu <at> gmail.com>
2012-02-10 12:32:42 GMT
2012-02-10 12:32:42 GMT
After this patch a 2-pass encoding is possible. /usr/local/bin/ffmpeg -i test.mov -map 0:0 -map 0:0 -map 0:1 -acodec libfaac -ab 128000 -ac 2 -ar 48000 -vcodec libx264 -vcodec libx264 -pass 1 -b:v:0 300k -b:v:1 900k -stats:v:1 video2 -stats:v:0 video1 -t 10 -y x.ts /usr/local/bin/ffmpeg -i test.mov -map 0:0 -map 0:0 -map 0:1 -acodec libfaac -ab 128000 -ac 2 -ar 48000 -vcodec libx264 -vcodec libx264 -pass 2 -b:v:0 300k -b:v:1 900k -stats:v:1 video2 -stats:v:0 video1 -t 10 -y x.ts The initial bug in ffmpeg is that -passlogfile is a global option, hot a per stream as needed here. It would be helpful if someone can point me the way for a permanent solution.
From 8671583f416a2e5abd04daecb79a8f62d189db06 Mon Sep 17 00:00:00 2001
From: Tudor Suciu <tudor.suciu <at> gmail.com>
Date: Fri, 10 Feb 2012 13:18:43 +0100
Subject: [PATCH 2/2] libx264 multiple pass for multi-video
---
ffmpeg.c | 2 +-
libavcodec/libx264.c | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/ffmpeg.c b/ffmpeg.c
index a794dd3..cb5caa8 100644
--- a/ffmpeg.c
+++ b/ffmpeg.c
@@ -4995,7 +4995,7 @@ static const OptionDef options[] = {
#if CONFIG_AVFILTER
{ "filter", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(filters)}, "set stream filterchain",
"filter_list" },
#endif
- { "stats", OPT_BOOL, {&print_stats}, "print progress report during encoding", },
+ { "sstats", OPT_BOOL, {&print_stats}, "print progress report during encoding", },
{ "attach", HAS_ARG | OPT_FUNC2, {(void*)opt_attach}, "add an attachment to the output file",
"filename" },
{ "dump_attachment", HAS_ARG | OPT_STRING | OPT_SPEC, {.off = OFFSET(dump_attachment)}, "extract an
attachment into a file", "filename" },
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index 1380e0a..b77d500 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -399,6 +399,7 @@ static av_cold int X264_init(AVCodecContext *avctx)
x4->params.rc.i_aq_mode = x4->aq_mode;
if (x4->aq_strength >= 0)
x4->params.rc.f_aq_strength = x4->aq_strength;
+ PARSE_X264_OPT("stats", stats);
PARSE_X264_OPT("psy-rd", psy_rd);
PARSE_X264_OPT("deblock", deblock);
PARSE_X264_OPT("partitions", partitions);
@@ -544,7 +545,7 @@ static const AVOption options[] = {
{ "profile", "Set profile restrictions (cf. x264 --fullhelp) ", OFFSET(profile), AV_OPT_TYPE_STRING,
{ 0 }, 0, 0, VE},
{ "fastfirstpass", "Use fast settings when encoding first pass", OFFSET(fastfirstpass),
AV_OPT_TYPE_INT, { 1 }, 0, 1, VE},
{"level", "Specify level (as defined by Annex A)", OFFSET(level), AV_OPT_TYPE_STRING, {.str=NULL}, 0,
0, VE},
- {"passlogfile", "Filename for 2 pass stats", OFFSET(stats), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
+ {"stats", "Filename for 2 pass stats", OFFSET(stats), AV_OPT_TYPE_STRING, {0}, 0, 0, VE},
{"wpredp", "Weighted prediction for P-frames", OFFSET(wpredp), AV_OPT_TYPE_STRING, {.str=NULL}, 0,
0, VE},
{"x264opts", "x264 options", OFFSET(x264opts), AV_OPT_TYPE_STRING, {.str=NULL}, 0, 0, VE},
{ "crf", "Select the quality for constant quality mode", OFFSET(crf), AV_OPT_TYPE_FLOAT, {-1 }, -1,
FLT_MAX, VE },
--
--
1.7.5.4
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel <at> ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
RSS Feed