OSDN Git Service

Mcdeint is broken, so avoid using it as a deinterlacer. No more "Slowest," "Slow...
[handbrake-jp/handbrake-jp-git.git] / test / test.c
index d49d29d..106f7a2 100644 (file)
@@ -60,13 +60,13 @@ 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;
@@ -402,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"))
                 {
@@ -413,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;
@@ -428,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;
                 }
@@ -479,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"))
                 {
@@ -512,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;
@@ -522,42 +523,42 @@ static int HandleEvents( hb_handle_t * h )
                 if (!strcmp(preset_name, "iPhone / iPod Touch"))
                 {
                     mux = HB_MUX_MP4;
+                    job->ipod_atom = 1;
                     vcodec = HB_VCODEC_X264;
-                    job->h264_level = 30;
                     job->vbitrate = 960;
                     job->abitrate = 128;
                     job->arate = 48000;
                     acodec = HB_ACODEC_FAAC;
                     job->width = 480;
-                    x264opts = strdup("cabac=0:ref=1:analyse=all:me=umh:subme=6:no-fast-pskip=1:trellis=1");
+                    x264opts = strdup("level=30:cabac=0:ref=1:analyse=all:me=umh:subme=6:no-fast-pskip=1:trellis=1");
                     job->chapter_markers = 1;
                 }
 
                 if (!strcmp(preset_name, "iPod High-Rez"))
                 {
                     mux = HB_MUX_MP4;
+                    job->ipod_atom = 1;
                     vcodec = HB_VCODEC_X264;
-                    job->h264_level = 30;
                     job->vbitrate = 1500;
                     job->abitrate = 160;
                     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("level=30: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;
                 }
 
                 if (!strcmp(preset_name, "iPod Low-Rez"))
                 {
                     mux = HB_MUX_MP4;
+                    job->ipod_atom = 1;
                     vcodec = HB_VCODEC_X264;
-                    job->h264_level = 30;
                     job->vbitrate = 700;
                     job->abitrate = 160;
                     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("level=30: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;
                 }
 
@@ -624,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 )
@@ -816,6 +832,26 @@ static int HandleEvents( hb_handle_t * h )
                            job->audios[0] = 0;
                            job->audio_mixdowns[0] = audio_mixdown;
                        }
+                       
+                       if( audio_mixdown == HB_AMIXDOWN_DOLBYPLII_AC3)
+                       {
+               int i;
+               for( i = 3 ; i > 0; i--)
+               {                   
+                   job->audios[i*2+1] = job->audios[i];
+                   job->audios[i*2] = job->audios[i];
+                   if(job->audios[i] != -1  )
+                   {
+                       job->audio_mixdowns[i*2+1] = HB_AMIXDOWN_AC3;
+                       job->audio_mixdowns[i*2] = HB_AMIXDOWN_DOLBYPLII;
+                   }
+               }
+               
+               job->audios[1] = job->audios[0];
+               job->audio_mixdowns[1] = HB_AMIXDOWN_AC3;
+               job->audio_mixdowns[0] = HB_AMIXDOWN_DOLBYPLII;
+            }
+                       
             if( abitrate )
             {
                 job->abitrate = abitrate;
@@ -1134,7 +1170,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 (" );
@@ -1150,7 +1186,7 @@ static void ShowHelp()
      "    -d, --deinterlace       Deinterlace video with yadif/mcdeint filter\n"
      "          <YM:FD:MM:QP>     (default 0:-1:-1:1)\n"
      "           or\n"
-     "          <fast/slow/slower/slowest>\n"            
+     "          <fast/slow/slower>\n"            
      "    -7, --deblock           Deblock video with pp7 filter\n"
      "          <QP:M>            (default 0:2)\n"
      "    -8, --denoise           Denoise video with hqdn3d filter\n"
@@ -1170,12 +1206,15 @@ static void ShowHelp()
        
        
        "### Audio Options-----------------------------------------------------------\n\n"
-       "    -E, --aencoder <string> Set audio encoder (faac/lame/vorbis/ac3, ac3\n"
-    "                            meaning passthrough, default: guessed)\n"
+       "    -E, --aencoder <string> Audio encoder (faac/lame/vorbis/ac3/aac+ac3) \n"
+       "                            ac3 meaning passthrough, aac+ac3 meaning an\n"
+       "                            aac dpl2 mixdown paired with ac3 pass-thru\n"
+       "                            (default: guessed)\n"
        "    -B, --ab <kb/s>         Set audio bitrate (default: 128)\n"
        "    -a, --audio <string>    Select audio channel(s), separated by commas\n"
        "                            (\"none\" for no audio, \"1,2,3\" for multiple\n"
-       "                             tracks, default: first one, max: eight)\n"
+       "                             tracks, default: first one,\n"
+       "                             max 8 normally, max 4 with aac+ac3)\n"
     "    -6, --mixdown <string>  Format for surround sound downmixing\n"
     "                            (mono/stereo/dpl1/dpl2/6ch, default: dpl2)\n"
     "    -R, --arate             Set audio samplerate (" );
@@ -1211,9 +1250,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");
 
@@ -1227,13 +1266,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+ iPhone / iPod Touch:  -e x264 -b 960 -B 128 -R 48 -E faac -f mp4 -I -w 480 -m -x level=30: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 x264 -b 1500 -B 160 -R 48 -E faac -f mp4 -I -w 640 -m -x level=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 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 x264 -b 700 -B 160 -R 48 -E faac -f mp4 -I -w 320 -m -x level=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+ 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");
 
@@ -1243,8 +1282,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");
 }
 
 /****************************************************************************
@@ -1300,7 +1340,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' },
@@ -1315,8 +1355,8 @@ static int ParseOptions( int argc, char ** argv )
         int option_index = 0;
         int c;
 
-        c = getopt_long( argc, argv,
-                         "hvuC:f:4i:Io:t:Lc:ma:6:s:UFN:e:E:2dD:789gpOP::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 )
         {
@@ -1451,15 +1491,11 @@ static int ParseOptions( int argc, char ** argv )
                     }
                     else if (!( strcmp( optarg, "slow" ) ))
                     {
-                        deinterlace_opt = "0";
+                        deinterlace_opt = "2";
                     }
                     else if (!( strcmp( optarg, "slower" ) ))
                     {
-                        deinterlace_opt = "2:-1:1";
-                    }
-                    else if (!( strcmp( optarg, "slowest" ) ))
-                    {
-                        deinterlace_opt = "1:-1:1";
+                        deinterlace_opt = "0";
                     }
                     else
                     {
@@ -1563,6 +1599,12 @@ static int ParseOptions( int argc, char ** argv )
                 {
                     acodec = HB_ACODEC_VORBIS;
                 }
+                else if( !strcasecmp( optarg, "aac+ac3") )
+                {
+                    acodec = HB_ACODEC_FAAC;
+                    audio_mixdown = HB_AMIXDOWN_DOLBYPLII_AC3;
+                    arate = 48000;
+                }
                 break;
             case 'w':
                 width = atoi( optarg );
@@ -1632,7 +1674,7 @@ static int ParseOptions( int argc, char ** argv )
                 abitrate = atoi( optarg );
                 break;
             case 'Q':
-                crf = 1;
+                crf = 0;
                 break;
             case 'x':
                 x264opts = strdup( optarg );