tanersener / mobile-ffmpeg

FFmpeg for Android, iOS and tvOS. Not maintained anymore. Superseded by FFmpegKit.
https://tanersener.github.io/mobile-ffmpeg
GNU General Public License v3.0
3.85k stars 787 forks source link

Issue with converted video by mobile ffmpeg on iOS #678

Closed j2bmw closed 3 years ago

j2bmw commented 3 years ago

Description We use ffmpeg wrappers for our .net/c# based Android and iOS apps in Xamarin Forms. The command line (eg. ffmpeg -i "Front Garden_20210208105006.ps" "Front Garden_20210208105006.mp4") converts the downloaded video to mp4.

On iOS, the command line is executed successfully. It creates a video file in mp4. However, if the converted mp4 video is played back from the default media player on iOS, the video is barely visible when playing back from iPhone. I can see a little bit at the top, but the rest is blank. However, if I export it to a PC, I can watch the video on iTunes or a file manager app Wondershare Dr.Fone on PC. Please see the attached video file "IMG_0098.MP4" https://user-images.githubusercontent.com/30361626/107766401-825bd100-6d87-11eb-8fc6-777bd726a369.MP4 and the conversion log "convert to mp4 ios.txt" convert to mp4 ios.txt.

Expected behavior The converted video can be played with the default media player on iOS.

Current behavior The converted mp4 video is played back from the default media player on iOS, the video is barely visible when playing back from iPhone. I can see a little bit at the top, but the rest is blank.

Screenshots No

Logs convert to mp4 ios.txt.

Environment

Other

tanersener commented 3 years ago

Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 3840x2160 [SAR 1:1 DAR 16:9], 8110 kb/s, 20 fps, 20 tbr, 10240 tbn, 20 tbc (default)

This is the video stream in your file. It shows that your file is an mpeg4 video encoded using Simple Profile. Video resolution, fps values, sar, dar all are listed there.

Unfortunately, mobile devices (both Android and iOS) do not support all video codec vs. resolution vs. profile combinations. That's why you can play it on your desktop but can't play it on at iOS. I suggest you look at iOS documentation to see what iOS supports and update your command to encode your video using a supported codec & resolution pair.

j2bmw commented 3 years ago

@tanersener Many thanks for giving the direction. This is the info in my log: Video: h264, yuvj420p(pc, bt709, progressive), 3840x2160 [SAR 1:1 DAR 16:9], 20 fps,20 tbr, 90k tbn,40 tbc Stream mapping: (h264 (native) -> mpeg4 (native)) Video: mpeg4 (mp4v / 0x7634706D), yuv420p, 3840x2160 [SAR 1:1 DAR 16:9], q=2-31, 200 kb/s, 20 fps, 10240 tbn,, 20 tbc

I have resolved a similar issue on Android. Hope I will get this issue under control soon.

j2bmw commented 3 years ago

The issue has been resolved.