ffmpeg-kit icon indicating copy to clipboard operation
ffmpeg-kit copied to clipboard

Output file has only audio no video in ios, Working fine on Android.

Open dheerajrijhwani opened this issue 2 years ago • 4 comments

Description I am using ffmpeg_kit_flutter in my application. I am trying to add background music, text and gif on a video input. When I am creating the video from android it is working fine on android as well as ios, But when I am trying to create the output from ios it's not working on both platforms. I also notice that the video created from ios does not works on chrome browser, It is only showing audio in chrome

Expected behavior The video generated from ios should be similar to android, because the commands are same and parameters are same as well.

Current behavior Right now the video generated from ios does not work on ios and chrome, But it works on android platform. I am using flutter default video player to see the videos.

To Reproduce You can try to run the command on ios and android to get logs.

Screenshots No Screenshots, But attached the logs and video below.

Logs ios-logs.txt android-logs.txt

Environment

  • Platform: Android/Flutter/iOS/

  • Version: v4.5.1-LTS

  • Flutter Version: 3.0.5

Other Command which I am executing in android.

-i /data/user/0/com.consultingwhiz.sparksfly/cache/REC5962783986141428937.mp4 -i /data/user/0/com.consultingwhiz.sparksfly/cache/file_01.mp3 -stream_loop 2 -i /data/user/0/com.consultingwhiz.sparksfly/cache/gif_file.gif -filter_complex [0:v][2:v]overlay=(main_w-overlay_w) - 20:(main_h-overlay_h) - 20,drawtext=text=Discuss what you are looking for in a partner?:x=(w-text_w)/2:y=(h-text_h)-20:fontsize=24:fontcolor=white:fontfile=/data/user/0/com.consultingwhiz.sparksfly/cache/fonts.ttf;[0:a][1:a]amerge=inputs=2[a] -map 0:v -map [a] -q:v 4 -q:a 4 /data/user/0/com.consultingwhiz.sparksfly/cache/21843.mp4


Command which I am executing in IOS.

-i /var/mobile/Containers/Data/Application/619FAB12-A4F8-459D-A9F4-32D500390E03/Documents/camera/videos/REC_65A89F93-D78C-4924-A228-FC3E6E439CE5.mp4 -i /var/mobile/Containers/Data/Application/619FAB12-A4F8-459D-A9F4-32D500390E03/Library/Caches/file_01.mp3 -stream_loop 2 -i /var/mobile/Containers/Data/Application/619FAB12-A4F8-459D-A9F4-32D500390E03/Library/Caches/gif_file.gif -filter_complex [0:v][2:v]overlay=(main_w-overlay_w) - 20:(main_h-overlay_h) - 20,drawtext=text=Discuss what you are looking for in a partner?:x=(w-text_w)/2:y=(h-text_h)-20:fontsize=24:fontcolor=white:fontfile=/var/mobile/Containers/Data/Application/619FAB12-A4F8-459D-A9F4-32D500390E03/Library/Caches/fonts.ttf;[0:a][1:a]amerge=inputs=2[a] -map 0:v -map [a] -q:v 4 -q:a 4 /var/mobile/Containers/Data/Application/619FAB12-A4F8-459D-A9F4-32D500390E03/Library/Caches/16428.mp4


ios-logs.txt android-logs.txt

Video Generated from IOS

dheerajrijhwani avatar Aug 09 '22 15:08 dheerajrijhwani

I have compare logs on android and ios and I have noticed that Stream #0:0 and Stream #1:0 is different.

IOS:

Stream #0:0 [0x1] (und) : Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 60 kb/s

Stream #0:1 [0x2] (und) : Video: hevc (hvc1 / 0x31637668), yuv420p(tv, smpte170m/bt709/bt709), 480x640, 1130 kb/s


Android:

Stream #0:0 [0x1] (eng) : Video: h264 (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709, progressive), 720x480, 3484 kb/s

Stream #1:0 : Audio: mp3, 44100 Hz, stereo, fltp, 193 kb/s

dheerajrijhwani avatar Aug 09 '22 15:08 dheerajrijhwani

Input files used are not the same. Therefore output files produced are not the same.

Moreover, commands don't specify any format, codec options for the output files. So, ffmpeg is choosing those things for you. No one can guarantee that ffmpeg won't choose an iOS specific encoder, option that is not available on Android and produce a different file.

So, my suggestion is to produce files with the same audio/video formats first.

This is the video and audio format of the file created on Android.

mpeg4 (mp4v / 0x7634706D), yuv420p(tv, smpte170m/smpte170m/bt709, progressive), 480x720 [SAR 1:1 DAR 2:3], q=2-31, 200 kb/s
aac (mp4a / 0x6134706D), 48000 Hz, 3.0, fltp, 197 kb/s

And this is the file created on iOS.

mpeg4 (mp4v / 0x7634706D), yuv420p(tv, smpte170m/bt709/bt709, progressive), 480x640, q=2-31, 200 kb/s
aac (mp4a / 0x6134706D), 44100 Hz, 3.0, fltp, 197 kb/s

tanersener avatar Aug 09 '22 16:08 tanersener

@tanersener I tried with provide same video input file to android and ios. Still the output is same (Not Working). Can you tell what other values or parameters I have to add in the command to set the format and codecs. I am confused on where to put codecs or parameters and what values should I put.

Thanks for your help.

dheerajrijhwani avatar Aug 10 '22 15:08 dheerajrijhwani

Well, how about asking google about it?

tanersener avatar Aug 10 '22 17:08 tanersener

This issue is stale because it has been open 60 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] avatar Oct 10 '22 03:10 github-actions[bot]

This issue was closed because it has been stalled for 7 days with no activity.

github-actions[bot] avatar Oct 17 '22 04:10 github-actions[bot]