使用cat命令合并2个MP4文件

时间:2016-04-15 22:03:00

标签: macos bash unix cat

我在OS X 10.10上,我正在尝试使用cat命令合并2个MP4文件。我以为我可以使用cat命令执行此操作,但似乎无法正常工作。当我将两个文件合并在一起并将其写入第三个文件时,第三个文件只包含第一个文件的内容(当我使用QuickTime打开它时)。根据我的理解,cat命令只是将纯文本从第一个文件复制并粘贴到第三个文件,然后将纯文本从第二个文件复制到第三个文件(附加它),但QuickTime只能识别第一部分。 有没有办法使用cat命令来解决这个问题?

2 个答案:

答案 0 :(得分:1)

我认为您对mp4box的{​​{1}}选项感到困惑,您可以使用该选项执行以下操作:

-cat

要合并 1.mp4 2.mp4 3 .mp4 merged.mp4

否则,mp4box -add 1.mp4 -cat 2.mp4 -cat 3.mp4 merged.mp4不支持此类行为。

答案 1 :(得分:0)

没有。 @IBAction func loginWithAmazon() { let scopes = ["alexa:all"]; let codeChallenge = sha256("CODE_CHALLENGE_GOES_HERE".dataUsingEncoding(NSUTF8StringEncoding)!).base64EncodedStringWithOptions(NSDataBase64EncodingOptions.Encoding64CharacterLineLength) var options: [String: AnyObject] = [:] let scopeData = String(format: "{\"alexa:all\":{\"productID\":\"%@\",\"productInstanceAttributes\":{\"deviceSerialNumber\":\"%@\"}}}", "yourAppIDHere", "anyUniqueID") options[kAIOptionScopeData] = scopeData; options[kAIOptionReturnAuthCode] = true; options[kAIOptionCodeChallenge] = codeChallenge; options[kAIOptionCodeChallengeMethod] = "S256"; AIMobileLib.authorizeUserForScopes(scopes, delegate: self, options: options); } func requestDidSucceed(apiResult: APIResult!) { accessToken = apiResult.result print(apiResult.result) } func requestDidFail(errorResponse: APIError!) { print(errorResponse.error) } ================================================= func sha256(data : NSData) -> NSData { var hash = [UInt8](count: Int(CC_SHA256_DIGEST_LENGTH), repeatedValue: 0) CC_SHA256(data.bytes, CC_LONG(data.length), &hash) let res = NSData(bytes: hash, length: Int(CC_SHA256_DIGEST_LENGTH)) return res } 根本不操纵文件的元数据,因此除非文件格式已设计为使用简单连接,否则无法使用它来合并非文本文件。