要更改比特率或减小文件大小. [英] Want to change the Bit Rate or reduce file size.

查看:169
本文介绍了要更改比特率或减小文件大小.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我正在使用 DirectShow.NET [

Hi,
I am recording video using DirectShow.NET[^]. The Video size is too large like 9sec video is 364MB. Please help me how to reduce the Video size.

推荐答案

您正在从模拟摄像机接收原始视频,而不是从IP摄像机接收压缩视频.您需要查看的是将视频压缩应用于原始视频帧.

您应该在CodeProject和Web上搜索有关此主题的提示和想法,并在进行这样的项目时开始考虑以下基本问题:

-您的应用程序的目的.当您决定下列问题时,切合实际非常重要.以高帧速率获得高分辨率真是太好了,但是正如您所发现的,它可以直接转换为大视频文件.视频监视,电影录制和视频聊天应用程序之间的需求存在很大差异.

-所需的最小图像尺寸.一个不错的起点是查看320x240的图像.如果您使用的是好的相机,这看起来可能不错,但是如今,它很可能不会裁切.下一步是640x480图像,显然可以为您提供更多细节,但是要处理的视频数据是320x240的4倍,一旦达到640x480分辨率,视频将被隔行扫描,您必须决定如何处理-从此处开始:
www.100fps.com [ 如果您想从简单开始,请尝试使此JPEG编码器正常工作,以便录制Motion JPEG视频罗马金茨堡 [ nVLC [ ^ ].

-文件记录.您必须决定如何组织文件.如果您的应用程序用于家庭的圣诞节问候"之类的简单操作,则可能只需要处理一个文件,但是您应该考虑文件大小限制的问题(例如,请参见http://neuron2.net/LVG/filesize.html [ ^ ]),并准备将视频存储在多个文件中.如果计划进行连续记录,则还必须实现逻辑,当驱动器空间不足或存储的视频总大小达到预设阈值时,删除最旧的视频文件.

希望这可以帮助您入门.


Soren Madsen
You are receiving raw video from an analog camera as opposed to compressed video from an IP camera. What you need to look at is applying video compression to your raw video frames.

You should search CodeProject and the web for tips and ideas on this subject and start considering the following basic issues when you take on a project like this:

- The purpose of your application. It is very important to be realistic when you decide on the issues listed below. It is great to have high resolution at high frame rate, but that translates directly into large video files as you have discovered. There is a big difference in the requirements between video surveillance, movie recording and video chat applications.

- The minimum image size needed. A good place to start is looking at a 320x240 image. This can look fine if you are using a good camera, but these days it is most likely not going to cut it. Next step is a 640x480 image which obviously gives you higher detail, but 4 times as much video data to handle compared to 320x240 and once you get to 640x480 resolution, the video will be interlaced and you have to decide how you are going to handle that - start by looking here: www.100fps.com[^].

- The minimum frame rate needed. If your video format is NTSC you should be receiving the video at 30 frames per second (PAL at 25 FPS). People always start out wanting the highest possible frame rate, but for many uses you can easily cut the rate to 15 FPS and still find it useable, in some cases you can go as low as 8 FPS and it will be fine.

- The video encoding to use. This is a huge topic and goes back to what the purpose of your application is. There are many different video CODECs out there and you have to decide which one suits you best. If you are developing a commercial application, you might have to deal with royalty fees if you pick the "wrong" encoder.
If you want to start with something simple, try getting this JPEG encoder working in order to record Motion JPEG video A Simple JPEG Encoder in C#[^]. I do not recommend that you settle with a MJPEG video format, but it is probably a good way for you to get your feet wet.
Roman Ginzburg[^] has implemented a .NET API for the libVLC interface. I have not tried this out myself, but it could be a relatively easy way to do some advanced video compression: nVLC[^].

- File recording. You have to decide how you are going to organize your files. If your application is used for something simple like a "Christmas greeting" for your family, you can probably get away with a single file, but you should consider issues with file size limits (as an example see http://neuron2.net/LVG/filesize.html[^]) and be prepared to store your video in multiple files. If you plan on doing continous recording, you also have to implement logic that deletes the oldest video files when you are running out of space on your drive or when the total size of the stored video reaches a preset threshold.

I hope this helps you get started.


Soren Madsen


这篇关于要更改比特率或减小文件大小.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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