I have an mp4 video file that I want to play it in iOS using avfoundation. Unfortunately, the file is not being played and save into the default gallery (photos) even it has h264 video codec and aac audio codec. And it is only playable when I reencode it using ffmpeg. I want to know why the file only becomes playable after reencoding the video?
Not Playable(originalFile.mp4) vs Playable File(outputFile.mp4) Information Comparison
File is playable with avfoundation when these commands are being applied:
ffmpeg -y -hide_banner -i originalFile.mp4 -f mp4 -vcodec h264 -vf scale=out_color_matrix=bt709 -color_primaries bt709 -color_trc bt709 -colorspace bt709 -b:v 5703k -acodec aac -b:a 249k outputFile.mp4
ffmpeg -y -hide_banner -i originalFile.mp4 -f mp4 -vcodec h264 -acodec aac outputFile.mp4
File is not playable with avfoundation when this command is being applied:
ffmpeg -y -hide_banner -i originalFile.mp4 -f mp4 -vcodec copy -acodec aac outputFile.mp4
originalFile.mp4 file link: https://drive.google.com/file/d/1-yZFL0EsLztMIfwU79Al6dv8gdwJyGAD/view?usp=sharing
ffprobe streams of both files are here https://www.diffchecker.com/VgZL66QB
ffprobe -show_streams
for both original file and outputfile.ffmpeg -i originalFile.mp4 -c copy -color_primaries bt709 -color_trc bt709 -colorspace bt709 -movflags +faststart outputFile.mp4