Changeset 82
- Timestamp:
- 04/06/06 22:42:39 (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/org/thestaticvoid/iriverter/Converter.java
r81 r82 170 170 } 171 171 172 public void convertSingleVideo(SingleVideoInfo singleVideoInfo) { 173 progressDialogInfo.setInputVideo(new File(singleVideoInfo.getInputVideo()).getName()); 174 progressDialogInfo.setOutputVideo(new File(singleVideoInfo.getOutputVideo()).getName()); 175 progressDialogInfo.setStatus("Gathering information about the input video..."); 176 177 MPlayerInfo info = new MPlayerInfo(singleVideoInfo.getInputVideo()); 178 172 private List prepareBaseCommandList(String inputVideo, String outputVideo, MPlayerInfo info) { 179 173 int scaledWidth = converterOptions.getDimensions().getWidth(); 180 174 int scaledHeight = (info.getDimensions().getHeight() * converterOptions.getDimensions().getWidth()) / info.getDimensions().getWidth(); … … 203 197 204 198 commandList.add(MPlayerInfo.getMPlayerPath() + "mencoder"); 205 commandList.add( singleVideoInfo.getInputVideo());199 commandList.add(inputVideo); 206 200 207 201 if (converterOptions.getCurrentProfile().getWrapperFormat().equals("mp4")) { … … 213 207 214 208 commandList.add("-o"); 215 commandList.add( singleVideoInfo.getOutputVideo());209 commandList.add(outputVideo); 216 210 commandList.add("-ovc"); 217 211 commandList.add("xvid"); … … 250 244 } 251 245 246 return commandList; 247 } 248 249 public void convertSingleVideo(SingleVideoInfo singleVideoInfo) { 250 progressDialogInfo.setInputVideo(new File(singleVideoInfo.getInputVideo()).getName()); 251 progressDialogInfo.setOutputVideo(new File(singleVideoInfo.getInputVideo()).getName()); 252 progressDialogInfo.setStatus("Gathering information about the input video..."); 253 254 MPlayerInfo info = new MPlayerInfo(singleVideoInfo.getInputVideo()); 255 256 List commandList = prepareBaseCommandList(singleVideoInfo.getInputVideo(), singleVideoInfo.getOutputVideo(), info); 257 252 258 String[] command = new String[commandList.size()]; 253 259 for (int i = 0; i < command.length; i++) … … 278 284 MPlayerInfo info = new MPlayerInfo("dvd://" + dvdInfo.getTitle(), dvdInfo.getDrive()); 279 285 280 int scaledWidth = converterOptions.getDimensions().getWidth(); 281 int scaledHeight = (info.getDimensions().getHeight() * converterOptions.getDimensions().getWidth()) / info.getDimensions().getWidth(); 282 283 if (scaledHeight > converterOptions.getDimensions().getHeight()) { 284 scaledWidth = (scaledWidth * converterOptions.getDimensions().getHeight()) / scaledHeight; 285 scaledHeight = converterOptions.getDimensions().getHeight(); 286 } 287 288 double ofps = (info.getFrameRate() > converterOptions.getCurrentProfile().getMaxFrameRate() ? converterOptions.getCurrentProfile().getMaxFrameRate() : info.getFrameRate()); 289 290 String vf = "filmdint=io=" + ((int) Math.round(info.getFrameRate() * 1000)) + ":" + ((int) Math.round(ofps * 1000)); 291 if (converterOptions.getPanAndScan()) 292 vf += ",scale=" + ((int) ((info.getDimensions().getWidth()) * (((double) converterOptions.getDimensions().getHeight()) / (double) info.getDimensions().getHeight()))) + ":" + converterOptions.getDimensions().getHeight() + ",crop=" + converterOptions.getDimensions().getWidth() + ":" + converterOptions.getDimensions().getHeight(); 293 else 294 vf += ",scale=" + scaledWidth + ":" + scaledHeight + ",expand=" + converterOptions.getDimensions().getWidth() + ":" + converterOptions.getDimensions().getHeight(); 295 vf += ",harddup"; 296 297 String af = ""; 298 if (converterOptions.getVolumeFilter() == VolumeFilter.VOLNORM) 299 af = "volnorm," + af; 300 if (converterOptions.getVolumeFilter() == VolumeFilter.VOLUME) 301 af = "volume=" + converterOptions.getGain() + "," + af; 302 303 List commandList = new ArrayList(); 304 305 commandList.add(MPlayerInfo.getMPlayerPath() + "mencoder"); 286 List commandList = prepareBaseCommandList("dvd://" + dvdInfo.getTitle(), dvdInfo.getOutputVideo(), info); 287 306 288 commandList.add("-dvd-device"); 307 289 commandList.add(dvdInfo.getDrive()); 308 commandList.add("dvd://" + dvdInfo.getTitle()); 309 310 if (converterOptions.getCurrentProfile().getWrapperFormat().equals("mp4")) { 311 commandList.add("-of"); 312 commandList.add("lavf"); 313 commandList.add("-lavfopts"); 314 commandList.add("format=mp4:i_certify_that_my_video_stream_does_not_use_b_frames"); 315 } 316 317 commandList.add("-o"); 318 commandList.add(dvdInfo.getOutputVideo()); 319 commandList.add("-ovc"); 320 commandList.add("xvid"); 321 commandList.add("-xvidencopts"); 322 commandList.add("bitrate=" + converterOptions.getVideoBitrate() + ":max_bframes=0"); 323 commandList.add("-oac"); 324 if (converterOptions.getCurrentProfile().getAudioFormat().equals("aac")) { 325 commandList.add("faac"); 326 commandList.add("-faacopts"); 327 commandList.add("br=" + converterOptions.getAudioBitrate()); 328 } else { 329 commandList.add("mp3lame"); 330 commandList.add("-lameopts"); 331 commandList.add("mode=2:cbr:br=" + converterOptions.getAudioBitrate()); 332 } 333 commandList.add("-vf"); 334 commandList.add(vf); 335 336 if (!af.equals("")) { 337 commandList.add("-af"); 338 commandList.add(af); 339 } 340 341 commandList.add("-ofps"); 342 commandList.add("" + ofps); 343 commandList.add("-srate"); 344 commandList.add("44100"); 345 290 346 291 if (dvdInfo.getAudioStream() > -1) { 347 292 commandList.add("-aid"); … … 357 302 commandList.add("-chapter"); 358 303 commandList.add(dvdInfo.getChapters()[0].getFirstChapter() + "-" + dvdInfo.getChapters()[0].getLastChapter()); 359 }360 361 if (!converterOptions.getAutoSync()) {362 commandList.add("-mc");363 commandList.add("0");364 365 int offset = converterOptions.getAudioDelay();366 commandList.add("-delay");367 commandList.add("" + (offset / 1000.0));368 304 } 369 305
Note: See TracChangeset
for help on using the changeset viewer.
