![](/img/trans.png)
[英]How to play this video : BigBuckBunny as H264 Adaptive Bitrate MP4 Set 720p
[英]Cutting mp4 h264 video file without reencoding
我正在尋找一種方法來拆分或剪切用h264編碼的mp4視頻文件,而無需重新編碼。 到目前為止,為了編輯mp4 h264編碼的文件,我使用了Microsoft Expression Encoder 4 Pro。 問題是,我總是必須重新編碼文件,如果我只想剪切或分割視頻文件,這將花費一些時間和不必要的時間。 任何幫助或指向正確的方向表示贊賞。
我不知道如何在不進行重新編碼(轉碼)的情況下分割視頻,但是在Windows 8上已對視頻進行了轉碼:
要修剪文件,請調用aysnc方法PrepareFileTranscodeAsync,然后在PrepareTranscodeResult對象上調用TranscodeAsync方法。
例如:
async void TrimFile(StorageFile srcFile, StorageFile destFile)
{
MediaEncodingProfile profile =
MediaEncodingProfile.CreateMp4(VideoEncodingQuality.HD720p);
MediaTranscoder transcoder = new MediaTranscoder();
// Set the start of the trim.
transcoder.TrimStartTime = new TimeSpan(0, 0, 1);
// Set the end of the trim.
transcoder.TrimStopTime = new TimeSpan(0, 0, 9);
PrepareTranscodeResult prepareOp = await
transcoder.PrepareFileTranscodeAsync(srcFile, destFile, profile);
if (prepareOp.CanTranscode)
{
var transcodeOp = prepareOp.TranscodeAsync();
transcodeOp.Progress +=
new AsyncActionProgressHandler<double>(TranscodeProgress);
transcodeOp.Completed +=
new AsyncActionWithProgressCompletedHandler<double>(TranscodeComplete);
}
else
{
switch (prepareOp.FailureReason)
{
case TranscodeFailureReason.CodecNotFound:
OutputText("Codec not found.");
break;
case TranscodeFailureReason.InvalidProfile:
OutputText("Invalid profile.");
break;
default:
OutputText("Unknown failure.");
break;
}
}
}
如何修剪視頻文件(使用C#/ VB / C ++和XAML的Windows Store應用程序)
對於較舊的Windows,也可以使用Splicer (使用DirectShow.Net )。
希望它可以幫助某人。
libmp4v2為您提供了一些原語來構建一些自己執行的操作。 我不知道一個可以做到這一點的免費現成的解決方案,盡管只要您突破I幀的邊界,實現起來就相對容易。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.