如何使用asp.net c#压缩视频文件并存储在db中? [英] how to compress the video file and stored in db using asp.net c#?

查看:85
本文介绍了如何使用asp.net c#压缩视频文件并存储在db中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi sir,
     Tell me the steps to  compress the video file and stored in db using asp.net c#. Kindly give me the solution for this problem.

推荐答案

如果您想将视频文件存储在您的应用程序中,请浏览以下链接:



SQL Server的视频上传控件 [ ^ ]
If you want to store the video file in your application then go through the bellow link:

Video Uploader Control for SQL Server[^]


下面是代码片段....

它会起作用...



Below is the code snippet ....
It will work...

using (BinaryReader br = new BinaryReader(FileUpload1.PostedFile.InputStream))
        {
            byte[] bytes = br.ReadBytes((int)FileUpload1.PostedFile.InputStream.Length);
            string strConnString = 'give the connection string';
            using (SqlConnection con = new SqlConnection(strConnString))
            {
                using (SqlCommand cmd = new SqlCommand())
                {
                    cmd.CommandText = "insert into tblFiles(Name, ContentType, Data) values (@Name, @ContentType, @Data)";
                    cmd.Parameters.AddWithValue("@Name", Path.GetFileName(FileUpload1.PostedFile.FileName));
                    cmd.Parameters.AddWithValue("@ContentType", "video/mp4");
                    cmd.Parameters.AddWithValue("@Data", bytes);
                    cmd.Connection = con;
                    con.Open();
                    cmd.ExecuteNonQuery();
                    con.Close();
                }
            }
        }





如果有帮助请告诉我..



Let me know if it helps or not..


请参阅下面的视频压缩链接: -

视频压缩c# [ ^ ]

AviFile的简单C#包装器图书馆 [ ^ ]

http ://stackoverflow.com/questions/11153542/how-to-compress-files-in-c-sharp [ ^ ]

http://stackoverflow.com/questions/13993119/compress-avi-video-with-c-sharp [ ^ ]



用于上传视频文件到数据库: -

http://www.c-sharpcorner.com/Blogs/12576/upload-video-file-audio-file-and-image-file-in-sql-server- d.aspx [ ^ ]
refer below links for video compress:-
video compression in c#[^]
A Simple C# Wrapper for the AviFile Library[^]
http://stackoverflow.com/questions/11153542/how-to-compress-files-in-c-sharp[^]
http://stackoverflow.com/questions/13993119/compress-avi-video-with-c-sharp[^]

for uploading video files to database:-
http://www.c-sharpcorner.com/Blogs/12576/upload-video-file-audio-file-and-image-file-in-sql-server-d.aspx[^]


这篇关于如何使用asp.net c#压缩视频文件并存储在db中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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