static int h264_13 = 0;
static int h264_30 = 0;
static char * audios = NULL;
+static int surround = 0;
static int sub = 0;
static int width = 0;
static int height = 0;
static int abitrate = 0;
static int mux = 0;
static int acodec = 0;
+static int pixelratio = 0;
static int chapter_start = 0;
static int chapter_end = 0;
static int crf = 0;
+static char *x264opts = NULL;
+static char *x264opts2 = NULL;
+static int maxHeight = 0;
+static int maxWidth = 0;
/* Exit cleanly on Ctrl-C */
static volatile int die = 0;
}
}
}
+ hb_snooze( 200 );
#else
hb_snooze( 200 );
#endif
if( output ) free( output );
if( format ) free( format );
if( audios ) free( audios );
-
+ if( x264opts ) free (x264opts );
+ if( x264opts2 ) free (x264opts2 );
+
fprintf( stderr, "HandBrake has exited.\n" );
return 0;
{
fprintf( stderr, "Commands:\n" );
fprintf( stderr, " [h]elp Show this message\n" );
- fprintf( stderr, " [q]uit Exit HBTest\n" );
+ fprintf( stderr, " [q]uit Exit HandBrakeCLI\n" );
fprintf( stderr, " [p]ause Pause encoding\n" );
fprintf( stderr, " [r]esume Resume encoding\n" );
}
job->deinterlace = deinterlace;
job->grayscale = grayscale;
+ job->pixel_ratio = pixelratio;
if( width && height )
{
job->height = height;
hb_fix_aspect( job, HB_KEEP_HEIGHT );
}
- else
+ else if( !width && !height && !pixelratio )
{
hb_fix_aspect( job, HB_KEEP_WIDTH );
}
{
job->h264_level = 13;
}
- if( h264_30 )
- {
- job->h264_level = 30;
+ if( h264_30 )
+ {
+ job->h264_level = 30;
}
if( vrate )
{
job->audios[0] = -1;
}
}
+ if( surround )
+ {
+ job->surround = 1;
+ }
if( abitrate )
{
job->abitrate = abitrate;
fprintf( stderr, "Calculated bitrate: %d kbps\n",
job->vbitrate );
}
-
+
if( sub )
{
job->subtitle = sub - 1;
job->crf = 1;
}
+ if (x264opts != NULL && *x264opts != '\0' )
+ {
+ hb_log("Applying the following x264 options: %s", x264opts);
+ job->x264opts = x264opts;
+ }
+ else /*avoids a bus error crash when options aren't specified*/
+ {
+ job->x264opts = NULL;
+ }
+ if (maxWidth)
+ job->maxWidth = maxWidth;
+ if (maxHeight)
+ job->maxHeight = maxHeight;
+
if( twoPass )
{
job->pass = 1;
hb_add( h, job );
job->pass = 2;
+ job->x264opts = x264opts2;
hb_add( h, job );
}
else
int i;
fprintf( stderr,
- "Syntax: HBTest [options] -i <device> -o <file>\n"
+ "Syntax: HandBrakeCLI [options] -i <device> -o <file>\n"
"\n"
" -h, --help Print help\n"
" -u, --update Check for updates and exit\n"
" default: all chapters)\n"
" -a, --audio <string> Select audio channel(s) (\"none\" for no \n"
" audio, default: first one)\n"
+ " -6, --surround Export 5.1 surround as 6-channel AAC\n"
"\n"
" -s, --subtitle <number> Select subtitle (default: none)\n"
" -e, --encoder <string> Set video library encoder (ffmpeg,xvid,\n"
" -2, --two-pass Use two-pass mode\n"
" -d, --deinterlace Deinterlace video\n"
" -g, --grayscale Grayscale encoding\n"
+ " -p, --pixelratio Store pixel aspect ratio in video stream\n"
"\n"
" -r, --rate Set video framerate (" );
for( i = 0; i < hb_video_rates_count; i++ )
" -B, --ab <kb/s> Set audio bitrate (default: 128)\n"
" -w, --width <number> Set picture width\n"
" -l, --height <number> Set picture height\n"
- " --crop <T:B:L:R> Set cropping values (default: autocrop)\n" );
+ " --crop <T:B:L:R> Set cropping values (default: autocrop)\n"
+ " -Y, --maxHeight <#> Set maximum height\n"
+ " -X, --maxWidth <#> Set maximum width\n"
+ "\n"
+ " -x, --x264opts <string> Specify advanced x264 options in the\n"
+ " same style as mencoder:\n"
+ " option1=value1:option2=value2\n" );
}
/****************************************************************************
{ "title", required_argument, NULL, 't' },
{ "chapters", required_argument, NULL, 'c' },
{ "audio", required_argument, NULL, 'a' },
+ { "surround", no_argument, NULL, '6' },
{ "subtitle", required_argument, NULL, 's' },
{ "encoder", required_argument, NULL, 'e' },
{ "two-pass", no_argument, NULL, '2' },
{ "deinterlace", no_argument, NULL, 'd' },
{ "grayscale", no_argument, NULL, 'g' },
+ { "pixelratio", no_argument, NULL, 'p' },
{ "width", required_argument, NULL, 'w' },
{ "height", required_argument, NULL, 'l' },
{ "crop", required_argument, NULL, 'n' },
{ "rate", required_argument, NULL, 'r' },
{ "arate", required_argument, NULL, 'R' },
{ "crf", no_argument, NULL, 'Q' },
+ { "x264opts", required_argument, NULL, 'x' },
+ { "maxHeight", required_argument, NULL, 'Y' },
+ { "maxWidth", required_argument, NULL, 'X' },
{ 0, 0, 0, 0 }
};
int c;
c = getopt_long( argc, argv,
- "hvuC:f:i:o:t:c:a:s:e:E:2dgw:l:n:b:q:S:B:r:R:Q",
+ "hvuC:f:i:o:t:c:a:s:e:E:2dgpw:l:n:b:q:S:B:r:R:Qx:Y:X:",
long_options, &option_index );
if( c < 0 )
{
case 'a':
audios = strdup( optarg );
break;
+ case '6':
+ surround = 1;
+ break;
case 's':
sub = atoi( optarg );
break;
case 'g':
grayscale = 1;
break;
+ case 'p':
+ pixelratio = 1;
+ break;
case 'e':
if( !strcasecmp( optarg, "ffmpeg" ) )
{
case 'Q':
crf = 1;
break;
-
+ case 'x':
+ x264opts = strdup( optarg );
+ x264opts2 = strdup( optarg );
+ break;
+ case 'Y':
+ maxHeight = atoi( optarg );
+ break;
+ case 'X':
+ maxWidth = atoi (optarg );
+ break;
+
default:
fprintf( stderr, "unknown option (%s)\n", argv[optind] );
return -1;
acodec = HB_ACODEC_VORBIS;
}
}
+
+ if (acodec != HB_ACODEC_FAAC)
+ {
+ /* only attempt 5.1 export if exporting to AAC */
+ surround = 0;
+ }
+
}
return 0;