1

I made a console program that previews a video from webcam and captures it throught the MJPEG compression filter to .avi format. My schema:

WebCam
->IBaseFilter(Video capture filter)
 ->IBaseFilter(MJPEG compression filter)
  ------------->ICaptureGraphBuilder2::RenderStream
                ->.avi
  1. Any advice on how to set up MJPEG compression parameters via IAMVideoCompression interface to get the smallest video size and at least average quality? For now I set the putQuality method parameter to 0.1 and it helps me a lot; my video file size is about 15mb/minute.

  2. I can't render this captured .avi file with any video players (I tried Windows Media Player, WMP Classic, VLC). Do I need to make a decompressor before I can watch this video?

  3. Is there another compression filter I should be using? Which one is the best?

My aim is to write a video streaming server (like Skype). Do you think 15mb/minute is a good size to transfer the video packets down the network? I am going to use UDP(RTP) socket to transfer the mediastream.

Artjom B.
  • 61,146
  • 24
  • 125
  • 222
al072
  • 79
  • 2
  • 14

1 Answers1

0

You may want to look at Gstreamer.

An example pipeline to decode an MJPEG stream would be

gst-launch -v souphttpsrc location="http://[ip]:[port]/[dir]/xxx.cgi" do-timestamp=true is_live=true ! multipartdemux ! jpegdec ! ffmpegcolorspace ! autovideosink

To save it to a file instead

gst-launch -v souphttpsrc location="http://[ip]:[port]/[dir]/xxx.cgi" do-timestamp=true is_live=true ! multipartdemux ! jpegdec ! ffmpegcolorspace ! filesink location=test.avi

To get video from webcam and save it (tested on Ubuntu Linux)

gst-launch v4l2src ! jpegdec ! filesink location=test.avi

jpegdec is a bin to decode jpeg format that contains "idct-method" for the quality

You can write the above pipelines in equivalent C/C++, Java or Python code. It has pretty nice bindings.

For programming look at my other post

Playing RTSP with python-gstreamer

For network related stuff you may want to look at RTSP(UDP based RTP) look at my answer to the post here

Streaming using GStreamer

Community
  • 1
  • 1
enthusiasticgeek
  • 2,640
  • 46
  • 53