合并的视频文件无法正常工作 [英] merged video file not working correctly

查看:126
本文介绍了合并的视频文件无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

public void JoiningVideo()
{
    string j = @"D:/test2";

    string outputpath = @"D:/test3/beforeEventab1.wmv";
    DirectoryInfo di = new DirectoryInfo(j);
    FileStream fs;
    fs = new FileStream(outputpath, FileMode.Append);
    foreach (FileInfo fi in di.GetFiles(@"*.wmv"))
    {
        byte[] bytesource = System.IO.File.ReadAllBytes(fi.FullName);
        fs.Write(bytesource, 0, bytesource.Length);
    }
    fs.Close();
}







以下是加入两个视频的代码。当我运行该程序时,它会加入两个视频并将加入的视频放入一个文件夹中。加入的视频大小应该是正确的。



但是当我播放视频时它会在WMP中播放视频的第一部分,但是当我播放视频时VLC它播放视频的第二部分。




This following is a code to join two videos. When I run the program it joins two videos and puts joined video in a folder. The joined video size is correct as it should be.

But when I play the video it plays the first part of the video in WMP but when i play the video in VLC it plays the second part of video.

推荐答案

你不能把两个文件连在一起,并期望它们神奇地解决如何重新组织自己的问题! />


视频文件是复杂的对象,内部有多个流 - 要加入两个视频,您需要将视频流附加在一起,并将音频流分别附加在一起。你所做的就是将汽车焊接到你现有汽车的前面,并期望它神奇地成为一辆拉伸的豪华轿车!



如果你想加入视频,那么看看在VirtualDubMod - 它是开源的(它没有很好地连接文件,但你可以获得源代码)。我使用 AviDemux [ ^ ]当我想要 - 它的来源不可用,但它是免费的并且做得很好。
You can''t just bolt two files together and expect them to magically work out how to reorganise themselves!

Video files are complex objects, with multiple streams inside - to join two videos, you need to append the video streams together, and append the audio stream together separately. What you have done is weld a car onto the front of your existing car and expect it to magically become a stretched limousine!

If you want to join videos, then look at VirtualDubMod - it''s open source (it doesn''t join files very well but you can get the source). I use AviDemux[^] when I want to - it''s source isn''t available, but it''s free and does a pretty good job.


这篇关于合并的视频文件无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆