From 4f543b093321f1e277996dff8b96022573a3c86f Mon Sep 17 00:00:00 2001 From: yukihane Date: Thu, 4 Aug 2011 00:55:56 +0900 Subject: [PATCH] =?utf8?q?nicovideo.dll=20=E3=81=ABHD=E5=8B=95=E7=94=BB?= =?utf8?q?=E3=81=8B=E3=81=A9=E3=81=86=E3=81=8B=E3=82=92=E9=80=9A=E7=9F=A5?= =?utf8?q?=E3=81=99=E3=82=8B=E3=82=AA=E3=83=97=E3=82=B7=E3=83=A7=E3=83=B3?= =?utf8?q?=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- frontend/src/saccubus/converter/FfmpegCommand.java | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/frontend/src/saccubus/converter/FfmpegCommand.java b/frontend/src/saccubus/converter/FfmpegCommand.java index 6b47594..64b2eb4 100644 --- a/frontend/src/saccubus/converter/FfmpegCommand.java +++ b/frontend/src/saccubus/converter/FfmpegCommand.java @@ -135,15 +135,17 @@ public class FfmpegCommand extends AbstractCommand { } } + final Info info = MediaInfo.getInfo(new File("bin", "MediaInfo"), videoFile); + // 4:3 なら1.33, 16:9 なら1.76 + boolean isHD = ((double)info.getWidth()/(double)info.getHeight() > 1.5); if (ov.isResize()) { - final Info info = MediaInfo.getInfo(new File("bin", "MediaInfo"), videoFile); final Size scaled = (ov.isAdjustRatio()) ? MediaInfo.adjustSize(info, ov.getResizeWidth(), ov. getResizeHeight()) : new Size(info.getWidth(), info.getHeight()); cmdList.add("-s"); cmdList.add(scaled.getWidth() + "x" + scaled.getHeight()); } - List avfilterArgs = getAvfilterOptions(ov, addComment, commPath, addTcomment, tcommPath); + List avfilterArgs = getAvfilterOptions(ov, addComment, commPath, addTcomment, tcommPath, isHD); if (!avfilterArgs.isEmpty()) { cmdList.add("-vfilters"); @@ -191,14 +193,14 @@ public class FfmpegCommand extends AbstractCommand { } private List getAvfilterOptions(FfmpegOption ov, boolean addComment, String commPath, boolean addTcomment, - String tcommPath) throws UnsupportedEncodingException { + String tcommPath, boolean isHD) throws UnsupportedEncodingException { final List avfilterArgs = new ArrayList(); final String avfilterOption = ov.getAvfilterOption(); if (StringUtils.isNotBlank(avfilterOption)) { avfilterArgs.add(avfilterOption); } final String vhookArg = (getFfmpeg().isVhookDisabled()) - ? null : getVhookArg(addComment, commPath, addTcomment, tcommPath); + ? null : getVhookArg(addComment, commPath, addTcomment, tcommPath, isHD); if (vhookArg != null) { avfilterArgs.add(vhookArg); } @@ -206,7 +208,7 @@ public class FfmpegCommand extends AbstractCommand { } private String getVhookArg(boolean addComment, String commPath, boolean addTcomment, - String tcommPath) throws UnsupportedEncodingException { + String tcommPath, boolean isHD) throws UnsupportedEncodingException { StringBuilder sb = new StringBuilder(); sb.append("vhext="); sb.append(getFfmpeg().getVhook().getPath().replace("\\", "/")); @@ -244,6 +246,11 @@ public class FfmpegCommand extends AbstractCommand { } if (getFfmpeg().isCommentOpaque()) { sb.append("--enable-opaque-comment"); + sb.append("|"); + } + if(isHD){ + sb.append("--aspect-mode:1"); + sb.append("|"); } return sb.toString(); } -- 2.11.0