0

I have a react native app in which users can take a video. I limited the duration of the video to max 30 seconds (for storage purposes). On iOS, a video is in the mov-format. On android, the video is in mp4-format.

For easy use, I convert the mov-file on ios to mp4 using ffmpeg. This is my command:

-i video.mov -preset ultrafast -vcodec h264 -acodec aac video.mp4

I was testing this, and everything works as expected, but converting a 30 second video almost takes to minutes, even with the -preset ultrafast flag.

A possible improvement would be copying the audio (-c:a copy) instead of re-encoding it, but I don't think it would be much faster.

Size is about 50mb for a 30 second movie.

Sam Leurs
  • 1,592
  • 1
  • 19
  • 48

1 Answers1

3

If the MOV contains video and audio comaptible with MP4 then just re-mux (no re-encoding):

ffmpeg -i input.mov -c copy output.mp4
llogan
  • 121,796
  • 28
  • 232
  • 243
  • How can I check if the MOV contains video and audio compatible with mp4? Anyway, I'll give it a try! Thank you for your response! – Sam Leurs Feb 02 '21 at 11:15
  • @yesterday You can run `ffmpeg -i input.mov` and it will output info about the video and audio. If the video is `h264` or `hevc` and the audio is `aac` then it will work for you. – llogan Feb 02 '21 at 17:00
  • I did not know that command. Thank you! I was reading up on the internet and it seems that MOV and MP4 are quite similar, I did not know that. – Sam Leurs Feb 02 '21 at 17:02
  • @yesterday Yes, they are related, but MP4 does not support as many formats as MOV. If you need to automate/script the format check you can use `ffprobe`. [See Is there a way to use ffmpeg to determine the encoding of a file before transcoding?](https://stackoverflow.com/a/35280871/) – llogan Feb 02 '21 at 17:05