Ver código fonte

工具UI加入265编码器入口

张禹 5 anos atrás
pai
commit
710db5732b

BIN
iOS/QGVAPlayerDemo/Resource/vap_264_classical.mp4


BIN
iOS/QGVAPlayerDemo/Resource/vap_265_classical.mp4


+ 14 - 8
tool/vapxTool/VapxTool/Base.lproj/Main.storyboard

@@ -1,8 +1,8 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="15505" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
+<document type="com.apple.InterfaceBuilder3.Cocoa.Storyboard.XIB" version="3.0" toolsVersion="17156" targetRuntime="MacOSX.Cocoa" propertyAccessControl="none" useAutolayout="YES" initialViewController="B8D-0N-5wS">
     <dependencies>
         <deployment identifier="macosx"/>
-        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="15505"/>
+        <plugIn identifier="com.apple.InterfaceBuilder.CocoaPlugin" version="17156"/>
         <capability name="documents saved in the Xcode 8 format" minToolsVersion="8.0"/>
     </dependencies>
     <scenes>
@@ -66,6 +66,12 @@
                                                 <action selector="encoderDidChoose:" target="Voe-Tx-rLC" id="moQ-gI-2WT"/>
                                             </connections>
                                         </menuItem>
+                                        <menuItem title="libx265" id="dLS-m3-bMq">
+                                            <modifierMask key="keyEquivalentModifierMask"/>
+                                            <connections>
+                                                <action selector="encoderDidChoose:" target="Voe-Tx-rLC" id="AkC-ke-WuQ"/>
+                                            </connections>
+                                        </menuItem>
                                         <menuItem title="libvpx-vp9" id="Ycb-gh-d6S">
                                             <modifierMask key="keyEquivalentModifierMask"/>
                                             <connections>
@@ -471,7 +477,7 @@
                                 <rect key="frame" x="53" y="659" width="90" height="23"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                 <textFieldCell key="cell" lineBreakMode="clipping" title="基本信息" id="2cI-nd-OUt">
-                                    <font key="font" size="19" name=".PingFangSC-Regular"/>
+                                    <font key="font" metaFont="system" size="19"/>
                                     <color key="textColor" name="labelColor" catalog="System" colorSpace="catalog"/>
                                     <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                 </textFieldCell>
@@ -507,7 +513,7 @@
                                 <rect key="frame" x="279" y="658" width="58" height="17"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                 <textFieldCell key="cell" lineBreakMode="clipping" alignment="center" title="(默认不改)" id="Uky-I2-VE5">
-                                    <font key="font" size="10" name=".PingFangSC-Regular"/>
+                                    <font key="font" metaFont="system" size="10"/>
                                     <color key="textColor" name="systemRedColor" catalog="System" colorSpace="catalog"/>
                                     <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                 </textFieldCell>
@@ -608,7 +614,7 @@
                                 <rect key="frame" x="318" y="570" width="89" height="17"/>
                                 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                 <textFieldCell key="cell" lineBreakMode="clipping" title="已上传-100帧 " id="pv7-P5-4qU">
-                                    <font key="font" size="11" name=".PingFangSC-Regular"/>
+                                    <font key="font" metaFont="smallSystem"/>
                                     <color key="textColor" name="systemRedColor" catalog="System" colorSpace="catalog"/>
                                     <color key="backgroundColor" name="textBackgroundColor" catalog="System" colorSpace="catalog"/>
                                 </textFieldCell>
@@ -683,7 +689,7 @@
                                 <autoresizingMask key="autoresizingMask" flexibleMinX="YES" flexibleMinY="YES"/>
                                 <buttonCell key="cell" type="push" title="输出目录" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="UPr-W4-XYI">
                                     <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                                    <font key="font" size="13" name=".PingFangSC-Regular"/>
+                                    <font key="font" metaFont="system"/>
                                 </buttonCell>
                                 <connections>
                                     <action selector="onOpenOuputFolderBtnClicked:" target="XfG-lQ-9wD" id="XtB-Ae-k37"/>
@@ -694,7 +700,7 @@
                                 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                 <buttonCell key="cell" type="check" title="经典模式" bezelStyle="regularSquare" imagePosition="left" inset="2" id="2Oo-Qo-hcr">
                                     <behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
-                                    <font key="font" size="13" name=".PingFangSC-Regular"/>
+                                    <font key="font" metaFont="system"/>
                                 </buttonCell>
                                 <connections>
                                     <action selector="onClassicModeButtonClicked:" target="XfG-lQ-9wD" id="53D-Lf-IHg"/>
@@ -705,7 +711,7 @@
                                 <autoresizingMask key="autoresizingMask" flexibleMaxX="YES" flexibleMinY="YES"/>
                                 <buttonCell key="cell" type="push" title="开源软件信息" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="pqE-1P-pvm">
                                     <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
-                                    <font key="font" size="13" name=".PingFangSC-Regular"/>
+                                    <font key="font" metaFont="system"/>
                                 </buttonCell>
                                 <connections>
                                     <action selector="openSourceInfoButtonDidClicked:" target="XfG-lQ-9wD" id="lBz-FT-8M3"/>

+ 31 - 26
tool/vapxTool/VapxTool/controllers/VapxMP4Decoder.m

@@ -48,6 +48,11 @@
         }
     });
     
+    __block BOOL isH265;
+    dispatch_sync(dispatch_get_main_queue(), ^{
+        isH265 = [[(AppDelegate *)[NSApplication sharedApplication].delegate encoder] isEqualToString:@"libx265"];
+    });
+    
     NSString *output = [self.resourceDirectory stringByAppendingPathComponent:outputName];
     
     if ([fileManager fileExistsAtPath:output]) {
@@ -58,39 +63,39 @@
             return nil;
         }
     }
-    NSMutableArray *arguments = [@[@"-r", [NSString stringWithFormat:@"%@", @(MAX(self.fps, 1))],
-                           @"-pattern_type", @"glob",
-                           @"-i", inputPath,
-                           @"-c:v", @"libx264",
-                           @"-pix_fmt", self.yuvFormat?:@"yuv420p",
-                           @"-profile:v", self.profile?:@"high",
-                           @"-level",@"4.0",
-                           @"-b:v", self.bitRate?: @"2000k",
-                           @"-bf", @"0",
-                           /*@"-crf", @"29",*/
-                           @"-bufsize", @"2000k", output] mutableCopy];
+    NSMutableArray *arguments = nil;
     
-    arguments = [@[@"-r", [NSString stringWithFormat:@"%@", @(MAX(self.fps, 1))],
-                           @"-pattern_type", @"glob",
-                           @"-i", inputPath,
-                           @"-c:v", @"libx265",
-                           @"-pix_fmt", self.yuvFormat?:@"yuv420p",
-                           @"-profile:v", self.profile?:@"main",
-                           @"-level",@"4.0",
-                           @"-b:v", self.bitRate?: @"2000k",
-                           /*@"-bf", @"0",*/
-                           @"-crf", @"29",
-                           /*@"-tag:v", @"hvc1",*/ output] mutableCopy];
-    
-    if (isVp9) {
+    if (isH265) {
+        arguments = [@[@"-r", [NSString stringWithFormat:@"%@", @(MAX(self.fps, 1))],
+                               @"-pattern_type", @"glob",
+                               @"-i", inputPath,
+                               @"-c:v", @"libx265",
+                               @"-pix_fmt", self.yuvFormat?:@"yuv420p",
+                               @"-profile:v", self.profile?:@"main",
+                               @"-level",@"4.0",
+                               @"-b:v", self.bitRate?: @"2000k",
+                               /*@"-bf", @"0",*/
+                               @"-crf", @"29",
+                               @"-tag:v", @"hvc1", output] mutableCopy];
+    } else if (isVp9) {
         arguments = [@[@"-framerate", [NSString stringWithFormat:@"%@", @(MAX(self.fps, 1))],
                        @"-pattern_type", @"glob",
                                    @"-i", inputPath,
                                    @"-c:v", @"libvpx-vp9",
                                    @"-pix_fmt", self.yuvFormat?:@"yuv420p",
                                    @"-b:v", self.bitRate?: @"2000k", output] mutableCopy];
-        
-        
+    } else {
+        arguments = [@[@"-r", [NSString stringWithFormat:@"%@", @(MAX(self.fps, 1))],
+                               @"-pattern_type", @"glob",
+                               @"-i", inputPath,
+                               @"-c:v", @"libx264",
+                               @"-pix_fmt", self.yuvFormat?:@"yuv420p",
+                               @"-profile:v", self.profile?:@"high",
+                               @"-level",@"4.0",
+                               @"-b:v", self.bitRate?: @"2000k",
+                               @"-bf", @"0",
+                               /*@"-crf", @"29",*/
+                               @"-bufsize", @"2000k", output] mutableCopy];
     }
     
     if (self.audioPath.length > 0) {