Xamarin.IOS mov to mp4 conversion

hi All,

can anybody help me to convert mov file to mp4 file.

my requiremnnt is that i have an "mov" file which is huge in size . and i need to size down by compressing it to mp4 .

anyone faced these kind of requirement before ?

thanks in advance

Answers

  • DaveHuntDaveHunt USMember ✭✭✭✭✭

    AVAssetExportSession should do it (Apple doc here).

  • FebinDonzManGroveFebinDonzManGrove USMember ✭✭
    edited March 2016

    thanks DaveHunt for the reply.

    i have tried my luck with AVAssetExportSession. as below,

    `
    var asset = AVAsset.FromUrl( new NSUrl( sourceFilePath ) )

                AVAssetExportSession export = new AVAssetExportSession (asset, AVAssetExportSession.PresetLowQuality );
    
                export.OutputUrl = new NSUrl ( downloadFilePath );
                export.OutputFileType = AVFileType.Mpeg4;
                export.ShouldOptimizeForNetworkUse = true;
    
                export.ExportAsynchronously(  ( ) => 
                {
                    System.Diagnostics.Debug.WriteLine( export.Error.LocalizedDescription );
                });
    

    `

    but i am getting an error "Unknown Error" in export.Error.LocalizedDescription. any idea ?

  • FebinDonzManGroveFebinDonzManGrove USMember ✭✭

    got the issue . when dealing with NSUrl . use NSURl.FromFileName( path ) **than new NSUrl( path )**

    below piece of code works for me now.

    ` string downloadPath = Environment.GetFolderPath(Environment.SpecialFolder.Personal);
    string downloadFilePath = Path.Combine(downloadPath, "compressed_video.mp4");

                var asset = AVAsset.FromUrl( NSUrl.FromFilename( sourceFilePath ) );
    
    
                AVAssetExportSession export = new AVAssetExportSession (asset, AVAssetExportSession.PresetLowQuality );
    
                export.OutputUrl = NSUrl.FromFilename( downloadFilePath );
                export.OutputFileType = AVFileType.Mpeg4;
                export.ShouldOptimizeForNetworkUse = true;
    
                export.ExportAsynchronously(  ( ) => 
                {
    
                        if( export.Error != null )
                            System.Diagnostics.Debug.WriteLine( export.Error.LocalizedDescription );
                });`
    
  • InloveSelfInloveSelf ARMember

    Sorry to bother you mates but this really seems to be the only thread i can find about video conversion? I also have a problem of MP4 playback which I downloaded from YouTube yesterday. The video couldn't be played on VLC media Player. I downloaded this video repair program (videoconverterfactory.com/tips/repair-mp4-file.html) as you can see, to repair mp4 file. In the article it mentions that i can repair a video by converting formats. I do not know how it work, but after I added my MP4 video into the program, it requested me to choose a codec. There were 2 , H264 and MPEG4, i do not know which encoder i should select. I also find another type of video file named MJPEG on the internet and I do not know what are the relations between them. The original video which i downloaded is MPEG4, but it does not work as i have said right above. As for H264, i know that it is a compressed encoder, so i am worrying that there may be some dramatic quality loss in the course of conversion, is that true? The video output resolution and frame rate is 1080p- 60fps and i do not literally like to decrease the file size by losing video output quality and decreasing it to 30fps which is less smooth. How should i fix a video without changing codec? Any one has any constructive ideas?

  • lindasharplindasharp Member

    Hi, there is a lot of freeware and shareware available on the net to do so
    but to my personal experience, I prefer to VideoSolo Free Video Converter to convert video/audio file with no limitation and no quality loss. I'm sure it can help you convert MOV to MP4easily.

  • BrianConradBrianConrad USMember ✭✭✭

    Command line with FFMpeg installed:
    FFMpeg -i <video.mov> -c:v copy -c:a copy <output.mp4>
    Will wrap the contents (that is h264) of a .mov container in a .mp4 container.

Sign In or Register to comment.