Changing the OutputFileName

Jun 1, 2010 at 4:35 AM

Hello,

Like others have said, I think this library is great. I love API style developer tools.

I've a WPF novice, and futzing around with a hobby app using a webcam and WPFMediaKit. The problem I'm looking to solve is to be saving video (or just playing it without saving) and then change the filename to save to a new video. Basically, I want to show video in the window, and then allow for the user to click a button to start\stop video capture. Each capture session would write to a new filename.

I've successfully used the OutputFileName to save to a file, and from reading around I understand that I need to basically reload the control when choosing a new filename and setting that value (or also clearing the filename.) Is there a recommended way to do this? I don't care if the window or control flicker during this process. I suspect this is more of a WPF question, as there will be a way to force recreating the control (I tried an UpdateLayout call on the control and it's parent, which didn't work.)

Thanks for any pointers you can give me.

Chris

 

Coordinator
Jun 1, 2010 at 5:13 AM
Thanks!  Hope you are finding it useful!

The OutputFileName feature was a user submitted patch that really only covers very simple use cases.  You can't set any encoding parameters like fps, bitrate, etc.  You also have to start and stop the player to change the output.  I've never tried, but you can try, Stop(), change the output filename, then Play().

There is another option for you, but it'll take a small amount of work.  If you EnableSampleGrabbing=true on the VideoCaptureElement and set the NewVideoSample event handler, you can get access to the raw video frames.  That won't do you much good alone, so I have this class in another project.  It's an encoder class that will take raw uncompressed input and write it to a WMV file.  You have all the options to set bitrate and fps and you can switch filenames without stopping the webcam.  You can see how it builds the encoding profile here.  Usage is simple..sorta like this.

Let me know if you have any other questions on this!

-Jer
Jun 2, 2010 at 4:08 AM

I just looked through this stuff and I think it will be a big help. I'll give it try soon and report back.

Thanks!

Chris

Apr 4, 2013 at 9:07 PM
Hello jmorrill, Great library you have here 10x alot,
I've managed to use this library to get pictures from my webcam without any effort, but in the video capture I'm close to bang my head againt a wall, is there a sample project for video capture in WPF??