Changeset 94

Show
Ignore:
Timestamp:
04/14/06 17:59:25 (3 years ago)
Author:
jlee
Message:

Command list clean-up and h264 support

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/src/Makefile.am

    r89 r94  
    7373        org/thestaticvoid/iriverter/icons/singlevideo-16.png 
    7474 
     75iriverter_resources = \ 
     76        gnu/regexp/MessagesBundle.properties 
     77 
    7578if !BUILD_GCJ 
    7679iriverter_jardir = $(pkgdatadir)/lib 
     
    9194 
    9295iriverter.jar: $(iriverter_jar_class_files) 
    93         $(JAR) cf $@ $(all_iriverter_jar_class_files) $(iriverter_icons) 
     96        $(JAR) cf $@ $(all_iriverter_jar_class_files) $(iriverter_icons) $(iriverter_resources) 
    9497 
    9598swt.jar: $(SWT_JAR) 
  • trunk/src/org/thestaticvoid/iriverter/Converter.java

    r87 r94  
    175175         
    176176        private List prepareBaseCommandList(String inputVideo, String outputVideo, MPlayerInfo info) {           
    177                 int scaledWidth = converterOptions.getDimensions().getWidth(); 
    178                 int scaledHeight = (info.getDimensions().getHeight() * converterOptions.getDimensions().getWidth()) / info.getDimensions().getWidth(); 
    179                  
    180                 if (scaledHeight > converterOptions.getDimensions().getHeight()) { 
    181                         scaledWidth = (scaledWidth * converterOptions.getDimensions().getHeight()) / scaledHeight; 
    182                         scaledHeight = converterOptions.getDimensions().getHeight(); 
    183                 } 
    184                  
    185                 double ofps = (info.getFrameRate() > converterOptions.getCurrentProfile().getMaxFrameRate() ? converterOptions.getCurrentProfile().getMaxFrameRate() : info.getFrameRate()); 
    186                  
    187                 String vf = "filmdint=io=" + ((int) Math.round(info.getFrameRate() * 1000)) + ":" + ((int) Math.round(ofps * 1000)); 
    188                 if (converterOptions.getPanAndScan()) 
    189                         vf += ",scale=" + ((int) ((info.getDimensions().getWidth()) * (((double) converterOptions.getDimensions().getHeight()) / (double) info.getDimensions().getHeight()))) + ":" + converterOptions.getDimensions().getHeight() + ",crop=" + converterOptions.getDimensions().getWidth() + ":" + converterOptions.getDimensions().getHeight(); 
    190                 else 
    191                         vf += ",scale=" + scaledWidth + ":" + scaledHeight + ",expand=" + converterOptions.getDimensions().getWidth() + ":" + converterOptions.getDimensions().getHeight(); 
    192                 vf += ",harddup"; 
    193                  
    194                 String af = ""; 
    195                 if (converterOptions.getVolumeFilter() == VolumeFilter.VOLNORM) 
    196                         af = "volnorm," + af; 
    197                 if (converterOptions.getVolumeFilter() == VolumeFilter.VOLUME) 
    198                         af = "volume=" + converterOptions.getGain() + "," + af; 
    199                  
    200177                List commandList = new ArrayList(); 
    201178                 
    202179                commandList.add(MPlayerInfo.getMPlayerPath() + "mencoder"); 
     180                 
    203181                commandList.add(inputVideo); 
     182                commandList.add("-o"); 
     183                commandList.add(outputVideo); 
    204184                 
    205185                if (converterOptions.getCurrentProfile().getWrapperFormat().equals("mp4")) { 
     
    208188                        commandList.add("-lavfopts"); 
    209189                        commandList.add("format=mp4:i_certify_that_my_video_stream_does_not_use_b_frames"); 
     190                } 
     191                 
     192                commandList.add("-ovc"); 
     193                if (converterOptions.getCurrentProfile().getVideoFormat().equals("h264")) { 
     194                        commandList.add("x264"); 
     195                        commandList.add("-x264encopts"); 
     196                        commandList.add("bitrate=" + converterOptions.getVideoBitrate() + ":bframes=0:level_idc=13:nocabac"); 
    210197                } else { 
     198                        commandList.add("xvid"); 
     199                        commandList.add("-xvidencopts"); 
     200                        commandList.add("bitrate=" + converterOptions.getVideoBitrate() + ":max_bframes=0:profile=sp0"); 
    211201                        commandList.add("-ffourcc"); 
    212                         commandList.add("XVID"); 
    213                 } 
    214                  
    215                 commandList.add("-o"); 
    216                 commandList.add(outputVideo); 
    217                 commandList.add("-ovc"); 
    218                 commandList.add("xvid"); 
    219                 commandList.add("-xvidencopts"); 
    220                 commandList.add("bitrate=" + converterOptions.getVideoBitrate() + ":max_bframes=0"); 
     202                        commandList.add("DX50"); 
     203                } 
     204                 
    221205                commandList.add("-oac"); 
    222206                if (converterOptions.getCurrentProfile().getAudioFormat().equals("aac")) { 
    223207                        commandList.add("faac"); 
    224208                        commandList.add("-faacopts"); 
    225                         commandList.add("br=" + converterOptions.getAudioBitrate()); 
     209                        commandList.add("br=" + converterOptions.getAudioBitrate() + ":object=1"); 
    226210                } else { 
    227211                        commandList.add("mp3lame"); 
     
    229213                        commandList.add("mode=2:cbr:br=" + converterOptions.getAudioBitrate()); 
    230214                } 
     215                 
     216                double ofps = (info.getFrameRate() > converterOptions.getCurrentProfile().getMaxFrameRate() ? converterOptions.getCurrentProfile().getMaxFrameRate() : info.getFrameRate()); 
    231217                commandList.add("-vf"); 
    232                 commandList.add(vf); 
    233                  
    234                 if (!af.equals("")) { 
     218                commandList.add("filmdint=io=" + ((int) Math.round(info.getFrameRate() * 1000)) + ":" + ((int) Math.round(ofps * 1000))); 
     219                 
     220                int scaledWidth = converterOptions.getDimensions().getWidth(); 
     221                int scaledHeight = (info.getDimensions().getHeight() * converterOptions.getDimensions().getWidth()) / info.getDimensions().getWidth(); 
     222                 
     223                if (scaledHeight > converterOptions.getDimensions().getHeight()) { 
     224                        scaledWidth = (scaledWidth * converterOptions.getDimensions().getHeight()) / scaledHeight; 
     225                        scaledHeight = converterOptions.getDimensions().getHeight(); 
     226                } 
     227                 
     228                commandList.add("-vf-add"); 
     229                if (converterOptions.getPanAndScan()) 
     230                        commandList.add("scale=" + ((int) ((info.getDimensions().getWidth()) * (((double) converterOptions.getDimensions().getHeight()) / (double) info.getDimensions().getHeight()))) + ":" + converterOptions.getDimensions().getHeight() + ",crop=" + converterOptions.getDimensions().getWidth() + ":" + converterOptions.getDimensions().getHeight()); 
     231                else 
     232                        commandList.add("scale=" + scaledWidth + ":" + scaledHeight + ",expand=" + converterOptions.getDimensions().getWidth() + ":" + converterOptions.getDimensions().getHeight()); 
     233                 
     234                commandList.add("-vf-add"); 
     235                commandList.add("harddup"); 
     236                 
     237                if (converterOptions.getVolumeFilter() == VolumeFilter.VOLNORM) { 
    235238                        commandList.add("-af"); 
    236                         commandList.add(af); 
     239                        commandList.add("volnorm"); 
     240                } else if (converterOptions.getVolumeFilter() == VolumeFilter.VOLUME) { 
     241                        commandList.add("-af"); 
     242                        commandList.add("volume=" + converterOptions.getGain()); 
    237243                } 
    238244                 
     
    243249                 
    244250                if (!converterOptions.getAutoSync()) { 
    245                         commandList.add("-mc"); 
    246                         commandList.add("0"); 
    247                          
    248                         int offset = converterOptions.getAudioDelay(); 
    249251                        commandList.add("-delay"); 
    250                         commandList.add("" + (offset / 1000.0)); 
     252                        commandList.add("" + (converterOptions.getAudioDelay() / 1000.0)); 
    251253                } 
    252254                 
  • trunk/src/org/thestaticvoid/iriverter/Profile.java

    r90 r94  
    9595        } 
    9696         
     97        public String getVideoFormat() { 
     98                String videoFormat = readOption("videoFormat"); 
     99                if (videoFormat.equals("")) 
     100                        return "mpeg4"; 
     101                 
     102                return videoFormat; 
     103        } 
     104         
    97105        public String getAudioFormat() { 
    98106                String audioFormat = readOption("audioFormat"); 
  • trunk/src/profiles/ipod.profile

    r90 r94  
    11brand=Apple 
    22device=iPod 5G 
    3 maxVideoBitrate=2500 
     3maxVideoBitrate=768 
    44maxAudioBitrate=160 
    55dimensions=320x240 
    66maxFrameRate=30 
    77wrapperFormat=mp4 
     8videoFormat=h264 
    89audioFormat=aac