arthenica / ffmpeg-kit

FFmpeg Kit for applications. Supports Android, Flutter, iOS, Linux, macOS, React Native and tvOS. Supersedes MobileFFmpeg, flutter_ffmpeg and react-native-ffmpeg.
https://arthenica.github.io/ffmpeg-kit
GNU Lesser General Public License v3.0
4.49k stars 600 forks source link

Same Command is not working on React-Native-ffmpeg #1035

Open aza1200 opened 2 months ago

aza1200 commented 2 months ago

Hello,

I am using react-native-ffmpeg-kit to encode a video with the following FFmpeg command:

ffmpeg -i input.mp4 -c:v hevc_videotoolbox -c:a aac -tag:v hvc1 -vf scale=1920:1080 -b:v 3000k -r 30 -movflags +faststart -y output.mp4

It works on local mac - ffmpeg(not-native-ffmpeg-kit) However, when I run this command on react-native ios simulator, I receive the following error message:

 LOG    libavutil      58.  2.100 / 58.  2.100
 LOG    libavcodec     60.  3.100 / 60.  3.100
 LOG    libavformat    60.  3.100 / 60.  3.100
 LOG    libavdevice    60.  1.100 / 60.  1.100
 LOG    libavfilter     9.  3.100 /  9.  3.100
 LOG    libswscale      7.  1.100 /  7.  1.100
 LOG    libswresample   4. 10.100 /  4. 10.100
 LOG  Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'file:///Users/aza1200/Library/Developer/CoreSimulator/Devices/B2FFF7CD-CEC4-405C-A53F-6353CD9648F3/data/Containers/Data/Application/3E0D2C8A-34F7-43CA-975D-6864C7FB4B5D/Library/Caches/ImagePicker/3C4E4D03-3128-4BCE-841D-D77BCC0EDA30.mp4':
 LOG    Metadata:
 LOG      major_brand     :
 LOG  isom
 LOG  
 LOG      minor_version   :
 LOG  512
 LOG  
 LOG      compatible_brands:
 LOG  isomiso2mp41
 LOG  
 LOG      encoder         :
 LOG  Lavf61.5.101
 LOG  
 LOG    Duration:
 LOG  00:02:54.71
 LOG  , start:
 LOG  0.000000
 LOG  , bitrate:
 LOG  26825 kb/s
 LOG  
 LOG    Stream #0:0
 LOG  [0x1]
 LOG  (und)
 LOG  : Video: hevc (hvc1 / 0x31637668), yuv420p(tv, bt709, progressive), 3840x2160, 26702 kb/s
 LOG  ,
 LOG  59.94 fps,
 LOG  59.94 tbr,
 LOG  60k tbn
 LOG   (default)
 LOG  
 LOG      Metadata:
 LOG        handler_name    :
 LOG  ISO Media file produced by Google Inc. Created on: 09/03/2024.
 LOG  
 LOG        vendor_id       :
 LOG  [0][0][0][0]
 LOG  
 LOG        encoder         :
 LOG  Lavc61.11.100 hevc_videotoolbox
 LOG  
 LOG    Stream #0:1
 LOG  [0x2]
 LOG  (eng)
 LOG  : Audio: aac (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 124 kb/s
 LOG   (default)
 LOG  
 LOG      Metadata:
 LOG        handler_name    :
 LOG  ISO Media file produced by Google Inc.
 LOG  
 LOG        vendor_id       :
 LOG  [0][0][0][0]
 LOG  
 LOG  Stream mapping:
 LOG    Stream #0:0 -> #0:0
 LOG   (hevc (native) -> hevc (hevc_videotoolbox))
 LOG  
 LOG    Stream #0:1 -> #0:1
 LOG   (aac (native) -> aac (native))
 LOG  
 LOG  Press [q] to stop, [?] for help
 LOG  [hevc_videotoolbox @ 0x115de72e0] Error encoding frame: -12905
 LOG  [hevc_videotoolbox @ 0x115de72e0] popping: -542398533
 LOG  [vost#0:0/hevc_videotoolbox @ 0x115de7010] Error initializing output stream: Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
 LOG  [aac @ 0x115de8550] Qavg: 29522.865
 LOG  [aac @ 0x115de8550] 2 frames left in the queue on closing
 LOG  Conversion failed!

Environment: FFmpeg version: 60.3.100 (via react-native-ffmpeg-kit) H.264 codec, 30 fps, 1220 kbps Command options: Video codec: hevc_videotoolbox Resize: 1920x1080 Video bitrate: 3000k Frame rate: 30 fps Audio codec: aac Other: -movflags +faststart Issue: It seems there’s an issue with the encoder (hevc_videotoolbox) while initializing the output stream. The error message suggests that the problem might be related to incorrect parameters, but I’m not sure which parameters are causing the issue (bitrate, resolution, frame rate, or something else).

Has anyone experienced this issue before? Any help or insights on how to resolve this would be greatly appreciated!

Thank you in advance!

github-actions[bot] commented 1 week ago

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.

tanersener commented 5 days ago

If there is a difference in behaviour, then outputs from local ffmpeg and react-native-ffmpeg-kit must be compared to understand the issue.