OSDN Git Service

- get rid of 'chapter merging'.
[handbrake-jp/handbrake-jp-git.git] / test / test.c
index 6cd7005..8926369 100644 (file)
@@ -39,6 +39,7 @@ static int    h264_13     = 0;
 static int    h264_30     = 0;
 static char * audios      = NULL;
 static int    audio_mixdown = HB_AMIXDOWN_DOLBYPLII;
+static float  dynamic_range_compression = 0;
 static int    sub         = 0;
 static int    width       = 0;
 static int    height      = 0;
@@ -59,18 +60,19 @@ static int    chapter_start = 0;
 static int    chapter_end   = 0;
 static int    chapter_markers = 0;
 static char * marker_file   = NULL;
-static int       crf                   = 0;
+static int       crf                   = 1;
 static char      *x264opts             = NULL;
 static char      *x264opts2    = NULL;
 static int       maxHeight             = 0;
 static int       maxWidth              = 0;
 static int    turbo_opts_enabled = 0;
-static char * turbo_opts = "ref=1:subme=1:me=dia:analyse=none:trellis=0:no-fast-pskip=0:8x8dct=0";
+static char * turbo_opts = "ref=1:subme=1:me=dia:analyse=none:trellis=0:no-fast-pskip=0:8x8dct=0:weightb=0";
 static int    largeFileSize = 0;
 static int    preset        = 0;
 static char * preset_name   = 0;
 static int    vfr           = 0;
 static int    mp4_optimize  = 0;
+static int    ipod_atom     = 0;
 
 /* Exit cleanly on Ctrl-C */
 static volatile int die = 0;
@@ -400,7 +402,7 @@ static int HandleEvents( hb_handle_t * h )
 
             if (preset)
             {
-                hb_log("+ Using preset: %s", preset_name);
+                fprintf( stderr, "+ Using preset: %s", preset_name);
                 
                 if (!strcmp(preset_name, "Animation"))
                 {
@@ -411,8 +413,9 @@ static int HandleEvents( hb_handle_t * h )
                     job->arate = 48000;
                     acodec = HB_ACODEC_FAAC;
                     x264opts = strdup("ref=5:mixed-refs:bframes=16:bime:weightb:b-rdo:direct=auto:b-pyramid:me=umh:subme=5:analyse=all:8x8dct:trellis=1:nr=150:no-fast-pskip:filter=2,2");
+                    deinterlace = 1;
+                    deinterlace_opt = "2:-1:1";
                     job->chapter_markers = 1;
-                    job->deinterlace = 1;
                     pixelratio = 1;
                     twoPass = 1;
                     turbo_opts_enabled = 1;
@@ -426,7 +429,7 @@ static int HandleEvents( hb_handle_t * h )
                     job->abitrate = 160;
                     job->arate = 48000;
                     acodec = HB_ACODEC_FAAC;
-                    x264opts = strdup("bframes=3:ref=1:subme=5:me=umh:no-fast-pskip=1:trellis=2:cabac=0");
+                    x264opts = strdup("bframes=3:ref=1:subme=5:me=umh:no-fast-pskip=1:trellis=1:cabac=0");
                     job->chapter_markers = 1;
                     pixelratio = 1;
                 }
@@ -477,7 +480,7 @@ static int HandleEvents( hb_handle_t * h )
                     job->abitrate = 160;
                     job->arate = 48000;
                     acodec = HB_ACODEC_FAAC;
-                 }
+                }
 
                 if (!strcmp(preset_name, "Constant Quality Rate"))
                 {
@@ -510,7 +513,7 @@ static int HandleEvents( hb_handle_t * h )
                     vcodec = HB_VCODEC_X264;
                     job->vbitrate = 1800;
                     acodec = HB_ACODEC_AC3;
-                    x264opts = strdup("ref=3:mixed-refs:bframes=16:bime:weightb:b-rdo:direct=auto:b-pyramid:me=umh:subme=6:analyse=all:8x8dct:trellis=1:no-fast-pskip");
+                    x264opts = strdup("ref=3:mixed-refs:bframes=16:bime:weightb:b-rdo:direct=auto:b-pyramid:me=umh:subme=7:analyse=all:8x8dct:trellis=1:no-fast-pskip");
                     job->chapter_markers = 1;
                     pixelratio = 1;
                     twoPass = 1;
@@ -541,7 +544,7 @@ static int HandleEvents( hb_handle_t * h )
                     job->arate = 48000;
                     acodec = HB_ACODEC_FAAC;
                     job->width = 640;
-                    x264opts = strdup("keyint=300:keyint-min=30:bframes=0:cabac=0:ref=1:vbv-maxrate=1500:vbv-bufsize=2000:analyse=all:me=umh:subme=6:no-fast-pskip=1");
+                    x264opts = strdup("bframes=0:cabac=0:ref=1:vbv-maxrate=1500:vbv-bufsize=2000:analyse=all:me=umh:subme=6:no-fast-pskip=1");
                     job->chapter_markers = 1;
                 }
 
@@ -555,7 +558,7 @@ static int HandleEvents( hb_handle_t * h )
                     job->arate = 48000;
                     acodec = HB_ACODEC_FAAC;
                     job->width = 320;
-                    x264opts = strdup("keyint=300:keyint-min=30:bframes=0:cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:subme=6:no-fast-pskip=1");
+                    x264opts = strdup("bframes=0:cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:subme=6:no-fast-pskip=1");
                     job->chapter_markers = 1;
                 }
 
@@ -622,11 +625,26 @@ static int HandleEvents( hb_handle_t * h )
                     job->arate = 48000;
                     acodec = HB_ACODEC_FAAC;
                     x264opts = strdup("ref=3:mixed-refs:bframes=16:bime:weightb:direct=auto:b-pyramid:me=umh:subme=6:analyse=all:8x8dct:trellis=1:nr=150:no-fast-pskip");
+                    deinterlace = 1;
+                    deinterlace_opt = "2:-1:1";
+                    denoise = 1;
+                    denoise_opt = "2:1:2:3";
                     job->chapter_markers = 1;
-                    job->deinterlace = 1;
                     twoPass = 1;
                     turbo_opts_enabled = 1;
                 }
+
+                if (!strcmp(preset_name, "Xbox 360"))
+                {
+                    mux = HB_MUX_MP4;
+                    vcodec = HB_VCODEC_X264;
+                    job->vbitrate = 2000;
+                    job->abitrate = 160;
+                    job->arate = 48000;
+                    acodec = HB_ACODEC_FAAC;
+                    x264opts = strdup("level=40:ref=3:mixed-refs:bframes=16:bime:weightb:b-rdo:direct=auto:b-pyramid:me=umh:subme=7:analyse=all:8x8dct:trellis=1:no-fast-pskip:filter=-2,-1");
+                    pixelratio = 1;
+                }
             }
             
                        if ( chapter_markers )
@@ -822,7 +840,11 @@ static int HandleEvents( hb_handle_t * h )
             {
                 job->acodec = acodec;
             }
-
+            if ( dynamic_range_compression )
+            {
+                job->dynamic_range_compression = dynamic_range_compression;
+            }
+            
             if( size )
             {
                 job->vbitrate = hb_calc_bitrate( job, size );
@@ -853,6 +875,10 @@ static int HandleEvents( hb_handle_t * h )
             {
                 job->mp4_optimize = 1;
             }
+            if ( ipod_atom )
+            {
+                job->ipod_atom = 1;
+            }
             
             job->file = strdup( output );
 
@@ -1095,6 +1121,7 @@ static void ShowHelp()
     "    -4, --large-file        Use 64-bit mp4 files that can hold more than\n"
     "                            4 GB. Note: Breaks iPod, @TV, PS3 compatibility.\n"""
     "    -O, --optimize          Optimize mp4 files for HTTP streaming\n"
+    "    -I, --ipod-atom         Mark mp4 files so iPods will accept them\n"
     "\n"
        
        "### Picture Settings---------------------------------------------------------\n\n"
@@ -1123,7 +1150,7 @@ static void ShowHelp()
        "    -e, --encoder <string>  Set video library encoder (ffmpeg,xvid,\n"
     "                            x264,x264b13,x264b30 default: ffmpeg)\n"
        "    -q, --quality <float>   Set video quality (0.0..1.0)\n"
-       "    -Q, --crf               Use with -q for CRF instead of CQP\n"
+       "    -Q, --cqp               Use with -q for CQP instead of CRF\n"
     "    -S, --size <MB>         Set target size\n"
        "    -b, --vb <kb/s>         Set video bitrate (default: 1000)\n"
        "    -r, --rate              Set video framerate (" );
@@ -1175,7 +1202,9 @@ static void ShowHelp()
             fprintf( stderr, "/" );
     }
     fprintf( stderr, " kHz)\n"
-   
+    "    -D, --drc <float>       Apply extra dynamic range compression to the audio,\n"
+    "                            making soft sounds louder. Range is 1.0 to 4.0\n"
+    "                            (too loud), with 1.5 - 2.5 being a useful range.\n"
     
        
        "\n"
@@ -1198,9 +1227,9 @@ static void ShowHelp()
  ****************************************************************************/
 static void ShowPresets()
 {
-    printf("\n+ Animation:  -e x264 -b 1000 -B 160 -R 48 -E faac -f mkv -m -d -p -2 -T -x ref=5:mixed-refs:bframes=16:bime:weightb:b-rdo:direct=auto:b-pyramid:me=umh:subme=5:analyse=all:8x8dct:trellis=1:nr=150:no-fast-pskip:filter=2,2\n");
+    printf("\n+ Animation:  -e x264 -b 1000 -B 160 -R 48 -E faac -f mkv --deinterlace=\"slower\" -m -p -2 -T -x ref=5:mixed-refs:bframes=16:bime:weightb:b-rdo:direct=auto:b-pyramid:me=umh:subme=5:analyse=all:8x8dct:trellis=1:nr=150:no-fast-pskip:filter=2,2\n");
 
-    printf("\n+ AppleTV:  -e x264 -b 2500 -B 160 -R 48 -E faac -f mp4 -m -p -x bframes=3:ref=1:subme=5:me=umh:no-fast-pskip=1:trellis=2:cabac=0\n");
+    printf("\n+ AppleTV:  -e x264 -b 2500 -B 160 -R 48 -E faac -f mp4 -m -p -x bframes=3:ref=1:subme=5:me=umh:no-fast-pskip=1:trellis=1:cabac=0\n");
 
     printf("\n+ Bedlam:  -e x264 -b 1800 -E ac3 -f mkv -m -p -2 -T -x ref=16:mixed-refs:bframes=16:bime:weightb:b-rdo:direct=auto:b-pyramid:me=umh:subme=7:me-range=64:analyse=all:8x8dct:trellis=2:no-fast-pskip:no-dct-decimate:filter=-2,-1\n");
 
@@ -1214,13 +1243,13 @@ static void ShowPresets()
 
     printf("\n+ Deux Six Quatre:  -e x264 -b 1600 -E ac3 -f mkv -m -p -2 -T -x ref=5:mixed-refs:bframes=3:bime:weightb:b-rdo:b-pyramid:me=umh:subme=7:trellis=1:analyse=all:8x8dct:no-fast-pskip\n");
 
-    printf("\n+ Film:  -e x264 -b 1800 -E ac3 -f mkv -m -p -2 -T -x ref=3:mixed-refs:bframes=16:bime:weightb:b-rdo:direct=auto:b-pyramid:me=umh:subme=6:analyse=all:8x8dct:trellis=1:no-fast-pskip\n");
+    printf("\n+ Film:  -e x264 -b 1800 -E ac3 -f mkv -m -p -2 -T -x ref=3:mixed-refs:bframes=16:bime:weightb:b-rdo:direct=auto:b-pyramid:me=umh:subme=7:analyse=all:8x8dct:trellis=1:no-fast-pskip\n");
 
     printf("\n+ iPhone / iPod Touch:  -e x264b30 -b 960 -B 128 -R 48 -E faac -f mp4 -w 480 -m -x cabac=0:ref=1:analyse=all:me=umh:subme=6:no-fast-pskip=1:trellis=1\n");
 
-    printf("\n+ iPod High-Rez:  -e x264b30 -b 1500 -B 160 -R 48 -E faac -f mp4 -w 640 -m -x keyint=300:keyint-min=30:bframes=0:cabac=0:ref=1:vbv-maxrate=1500:vbv-bufsize=2000:analyse=all:me=umh:subme=6:no-fast-pskip=1\n");
+    printf("\n+ iPod High-Rez:  -e x264b30 -b 1500 -B 160 -R 48 -E faac -f mp4 -w 640 -m -x bframes=0:cabac=0:ref=1:vbv-maxrate=1500:vbv-bufsize=2000:analyse=all:me=umh:subme=6:no-fast-pskip=1\n");
 
-    printf("\n+ iPod Low-Rez:  -e x264b30 -b 700 -B 160 -R 48 -E faac -f mp4 -w 320 -m -x keyint=300:keyint-min=30:bframes=0:cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:subme=6:no-fast-pskip=1\n");
+    printf("\n+ iPod Low-Rez:  -e x264b30 -b 700 -B 160 -R 48 -E faac -f mp4 -w 320 -m -x bframes=0:cabac=0:ref=1:vbv-maxrate=768:vbv-bufsize=2000:analyse=all:me=umh:subme=6:no-fast-pskip=1\n");
 
     printf("\n+ Normal:  -e x264 -b 1500 -B 160 -R 48 -E faac -f mp4 -m -p -2 -T -x ref=2:bframes=2:subme=5:me=umh\n");
 
@@ -1230,8 +1259,9 @@ static void ShowPresets()
 
     printf("\n+ QuickTime:  -e x264 -b 2000 -B 160 -R 48 -E faac -f mp4 -m -p -2 -T -x ref=3:mixed-refs:bframes=3:bime:weightb:b-rdo:direct=auto:me=umh:subme=5:analyse=all:trellis=1:no-fast-pskip\n");
 
-    printf("\n+ Television:  -e x264 -b 1300 -B 160 -R 48 -E faac -f mkv -m -d -2 -T -x ref=3:mixed-refs:bframes=16:bime:weightb:direct=auto:b-pyramid:me=umh:subme=6:analyse=all:8x8dct:trellis=1:nr=150:no-fast-pskip\n");
-    
+    printf("\n+ Television:  -e x264 -b 1300 -B 160 -R 48 -E faac -f mkv --deinterlace=\"slower\" --denoise=\"weak\" -m -2 -T -x ref=3:mixed-refs:bframes=16:bime:weightb:direct=auto:b-pyramid:me=umh:subme=6:analyse=all:8x8dct:trellis=1:nr=150:no-fast-pskip\n");
+
+    printf("\n+ Xbox 360:  -e x264 -b 2000 -B 160 -R 48 -E faac -f mp4 -p -x level=40:ref=3:mixed-refs:bframes=16:bime:weightb:b-rdo:direct=auto:b-pyramid:me=umh:subme=7:analyse=all:8x8dct:trellis=1:no-fast-pskip:filter=-2,-1\n");
 }
 
 /****************************************************************************
@@ -1253,6 +1283,7 @@ static int ParseOptions( int argc, char ** argv )
             { "output",      required_argument, NULL,    'o' },
             { "large-file",  no_argument,       NULL,    '4' },
             { "optimize",    no_argument,       NULL,    'O' },
+            { "ipod-atom",   no_argument,       NULL,    'I' },
             
             { "title",       required_argument, NULL,    't' },
             { "longest",     no_argument,       NULL,    'L' },
@@ -1260,6 +1291,7 @@ static int ParseOptions( int argc, char ** argv )
             { "markers",     optional_argument, NULL,    'm' },
             { "audio",       required_argument, NULL,    'a' },
             { "mixdown",     required_argument, NULL,    '6' },
+            { "drc",         required_argument, NULL,    'D' },
             { "subtitle",    required_argument, NULL,    's' },
             { "subtitle-scan", no_argument,     NULL,    'U' },
             { "subtitle-forced", no_argument,   NULL,    'F' },
@@ -1285,7 +1317,7 @@ static int ParseOptions( int argc, char ** argv )
             { "ab",          required_argument, NULL,    'B' },
             { "rate",        required_argument, NULL,    'r' },
             { "arate",       required_argument, NULL,    'R' },
-            { "crf",         no_argument,       NULL,    'Q' },
+            { "cqp",         no_argument,       NULL,    'Q' },
             { "x264opts",    required_argument, NULL,    'x' },
             { "turbo",       no_argument,       NULL,    'T' },
             { "maxHeight",   required_argument, NULL,    'Y' },
@@ -1300,8 +1332,8 @@ static int ParseOptions( int argc, char ** argv )
         int option_index = 0;
         int c;
 
-        c = getopt_long( argc, argv,
-                         "hvuC:f:4i:o:t:Lc:ma:6:s:UFN:e:E:2d789gpOP::w:l:n:b:q:S:B:r:R:Qx:TY:X:VZ:z",
+               c = getopt_long( argc, argv,
+                                                "hvuC:f:4i:Io:t:Lc:m::a:6:s:UFN:e:E:2dD:789gpOP::w:l:n:b:q:S:B:r:R:Qx:TY:X:VZ:z",
                          long_options, &option_index );
         if( c < 0 )
         {
@@ -1346,7 +1378,10 @@ static int ParseOptions( int argc, char ** argv )
             case 'O':
                 mp4_optimize = 1;
                 break;
-
+            case 'I':
+                ipod_atom = 1;
+                break;
+            
             case 't':
                 titleindex = atoi( optarg );
                 break;
@@ -1406,6 +1441,9 @@ static int ParseOptions( int argc, char ** argv )
                     audio_mixdown = HB_AMIXDOWN_6CH;
                 }
                 break;
+            case 'D':
+                dynamic_range_compression = atof( optarg );
+                break;
             case 's':
                 sub = atoi( optarg );
                 break;
@@ -1611,7 +1649,7 @@ static int ParseOptions( int argc, char ** argv )
                 abitrate = atoi( optarg );
                 break;
             case 'Q':
-                crf = 1;
+                crf = 0;
                 break;
             case 'x':
                 x264opts = strdup( optarg );