[Ffmpeg-devel] [PATCH] FAAC profile selection
Nicolas George
nicolas.george
Fri Apr 27 20:11:54 CEST 2007
Hi.
Ten days ago, someone (Tim Small) posted on ffmpeg-user to point that the
faac encoder was hard-coded to the low-complexity profile, and asking about
the best way to make it an option. I suggested to use the -profile option.
Since then, nothing.
Here is a patch (against a few minutes ago SVN) to do just that:
ffmpeg -i foo.flac -aq 100 -profile aac_ltp /tmp/ltp.aac
will encode in LTP profile.
The patch has two independent parts.
The part that changes faac.c is the one that do the work. It is absolutely
trivial, and certainly harmless.
The second part makes the constants aac_main, aac_low, aac_ssr and aac_ltp
known to ffmpeg. It requires #ifdefs and including faac.h, which is not very
namespace-friendly, so it require more thought. But it is not required,
-profile 3 would work just as well without it.
Regards,
--
Nicolas George
Index: faac.c
===================================================================
--- faac.c (revision 8851)
+++ faac.c (working copy)
@@ -54,7 +54,8 @@
}
/* put the options in the configuration struct */
- faac_cfg->aacObjectType = LOW;
+ faac_cfg->aacObjectType = avctx->profile == FF_PROFILE_UNKNOWN ?
+ LOW : avctx->profile;
faac_cfg->mpegVersion = MPEG4;
faac_cfg->useTns = 0;
faac_cfg->allowMidside = 1;
Index: utils.c
===================================================================
--- utils.c (revision 8851)
+++ utils.c (working copy)
@@ -37,6 +37,9 @@
#ifdef __MINGW32__
#include <fcntl.h>
#endif
+#ifdef CONFIG_LIBFAAC
+#include <faac.h>
+#endif
const uint8_t ff_reverse[256]={
0x00,0x80,0x40,0xC0,0x20,0xA0,0x60,0xE0,0x10,0x90,0x50,0xD0,0x30,0xB0,0x70,0xF0,
@@ -670,6 +673,12 @@
{"skip_bottom", "number of macroblock rows at the bottom which are skipped", OFFSET(skip_bottom), FF_OPT_TYPE_INT, DEFAULT, INT_MIN, INT_MAX, V|D},
{"profile", NULL, OFFSET(profile), FF_OPT_TYPE_INT, FF_PROFILE_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "profile"},
{"unknown", NULL, 0, FF_OPT_TYPE_CONST, FF_PROFILE_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "profile"},
+#ifdef CONFIG_LIBFAAC
+{"aac_main", NULL, 0, FF_OPT_TYPE_CONST, MAIN, INT_MIN, INT_MAX, A|E, "profile"},
+{"aac_low", NULL, 0, FF_OPT_TYPE_CONST, LOW, INT_MIN, INT_MAX, A|E, "profile"},
+{"aac_ssr", NULL, 0, FF_OPT_TYPE_CONST, SSR, INT_MIN, INT_MAX, A|E, "profile"},
+{"aac_ltp", NULL, 0, FF_OPT_TYPE_CONST, LTP, INT_MIN, INT_MAX, A|E, "profile"},
+#endif
{"level", NULL, OFFSET(level), FF_OPT_TYPE_INT, FF_LEVEL_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "level"},
{"unknown", NULL, 0, FF_OPT_TYPE_CONST, FF_LEVEL_UNKNOWN, INT_MIN, INT_MAX, V|A|E, "level"},
{"lowres", "decode at 1= 1/2, 2=1/4, 3=1/8 resolutions", OFFSET(lowres), FF_OPT_TYPE_INT, 0, 0, INT_MAX, V|D},
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 185 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20070427/e66b1e57/attachment.pgp>
More information about the ffmpeg-devel
mailing list