2

I'm developing a social video app which a user can capture a video or choose one from his photo library. The videos are not playing on android devices, and after some research we figured out that we should encode the videos on both sided to MPEG4 format.

Iv'e tried using AVAsset and AVMutableComposition, and the thing is that it generates VERY BIG files. a 20 seconds video was generated to 15 MB!

I guess I'm not the first to run into this issue, so please if you have any clue, let me know. Thanks!

EDIT

OK, the file size problem was in this line

AVAssetExportSession *finalExporter = [[AVAssetExportSession alloc] initWithAsset:mixComposition presetName:AVAssetExportPreset960x540];

changed it to:

AVAssetExportSession *finalExporter = [[AVAssetExportSession alloc] initWithAsset:mixComposition presetName:AVAssetExportPresetMediumQuality];

now the problem is it rotated left, sometimes right... and sometimes upside down.

rmaddy
  • 314,917
  • 42
  • 532
  • 579
Ariel
  • 143
  • 10

1 Answers1

0

I don't try it, but

you can check these link:

MOV to Mp4 video conversion iPhone Programmatically

https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariWebContent/CreatingVideoforSafarioniPhone/CreatingVideoforSafarioniPhone.html

or may use ffmpeg from http://ffmpeg.org/

http://ilpleut.be/code-ffmpeg

https://github.com/xiewei-wayne

Cœur
  • 37,241
  • 25
  • 195
  • 267
SayanC
  • 26
  • 1
  • 2
  • thanks, the first link was helpful, do you know the order of the AVAssetExportPreset by quality? – Ariel Jul 04 '13 at 13:50
  • please check the link regarding order : https://stackoverflow.com/questions/44898852/difference-between-various-avassetexportpreset – Victor Ray Mar 24 '19 at 15:36