I have a react native application that is attempting to transcode users videos so they are in a format both platforms can natively playback, we are doing it on device for now as we don't want to incur the API costs till we have a stable user base. I have a few questions and let me preface them with my ffmpeg knowledge is not the best and mostly cobbled together.
- Why does the following code produce videos that are unplayable but still have audio.
if (Platform.OS === 'ios') {
await FFmpegKit.execute(`-i ${path} -c:v hevc_videotoolbox -c:a aac -movflags +faststart -y ${outputPath}`);
} else {
await FFmpegKit.execute(`-i ${path} -c:v hevc_omx -c:a aac -movflags +faststart -y ${outputPath}`);
}
- Is there a better set of commands to run for 1080p videos that will be played back on both platforms?
I am getting ffmpeg into the app using https://github.com/arthenica/ffmpeg-kit and am using the min-gpl
distribution. If I set the commands to use their h264 alternatives for the codec (h264_videotoolbox
& h264_omx
) it produces working files but I was hoping to use hevc to minimize the file sizes.
Update - Solved
The -tag:v hvc1
needed to be added so that Apple players can play the HEVC content.