Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to trim a mp4 video in a Windows Phone 8 App

I want to trim a MP4 video in a Windows Phone 8 Application.

Say when saving a video, I only want to save the last two minutes. I have tried converting the video stream into a byte array and altering it. Since the mp4 format has headers and lot of other metadata it is not easy to achieve this fiddling with the byte array of the stream.

If it is a Windows Store app I can use MediaTranscode class in the Windows.Media.Transcoding API to achieve this like in the article below.

Trim Video Windows Store App Example

I pretty much want to do something similar in windows phone.

Is there a similar API I can use in WP?

I also have been looking into Microsoft Media Foundation to achieve this? I am no C++ expert and wanting achieve this in C#.

Any help or direction would be much appreciated. Thanks

like image 301
Saj Avatar asked May 15 '13 06:05

Saj


People also ask

How to shorten video file on Windows?

Right-click the video file, and choose “Open with” > “Photos“. Select the “Trim” button located at the upper-right portion of the window. Slide the two white sliders to where the portion of the video you wish to keep is in between them. The blue slider only shows the current frame and has no bearing on trimming.

How to trim MP4 on Windows?

Another free solution to trim MP4 on Windows is to use MiniTool MovieMaker. It is a free and easy-to-use video editor that supports multiple image, audio, and video formats. In addition, it also provides you with all the editing tools you need, such as trim, split, rotate, reverse, etc.

How to trim videos with Photos app?

First, you need to open the video you want to trim with Photos app. You can locate the video and right click on it, and then choose “Open with”, then click “Photos” from the drop-down list. Step 2. After loading the video, it will be automatically played with Photos app. You can see additional options on the top bar.

How do I trim a video on my computer?

Trim video After loading the video you want to trim, click “Edit” button to open the main editing window. Here you are allowed to cut video, rotate video, crop video, combine video clips, add watermark, or adjust output effects. Click the “Clip” tab to start cutting your video.

How to cut video in Windows 10 with Photos app?

Here we show you an easy way to cut video in Windows 10 with Photos app. Step 1. First, you need to open the video you want to trim with Photos app. You can locate the video and right click on it, and then choose “Open with”, then click “Photos” from the drop-down list. Step 2.


1 Answers

C# in general is not setup to do movie editing. It's older sibling c++ is where this done. I know that's not the answer you want to hear but sometimes that's the only reality there is. I was going to offer a hack to make it happen but after digging through the MSDN libraries I don't even see a worthy hack for this.

Find a C++ example and work from there. It will be a little headache but you are much better off than attempting to make C# bend beyond its elasticity point.

Here is a similar thread expressing your concerns.

http://forums.wpcentral.com/windows-phone-apps/204490-video-editing-apps.html

They have made the point that there isn't a single video editing tool on the entire market. With how long the market has been around I would assume this is because it's not a capability in C#. Which happens to be 99% of the developers working on windows phone right now.

like image 148
Anthony Russell Avatar answered Nov 14 '22 22:11

Anthony Russell