-
Notifications
You must be signed in to change notification settings - Fork 2.2k
mp3 to pcm command crash on iOS #596
Description
my code:
final String ffmpegCommand = '-hide_banner -y -i "$path" -f s16le -ar 44100 -af pan=stereo|c0=FL -ac 1 -acodec pcm_s16le "$newPath"';
FFmpegSession session = await FFmpegKit.execute(ffmpegCommand);
final state = FFmpegKitConfig.sessionStateToString(await session.getState());
final returnCode = await session.getReturnCode();
final failStackTrace = await session.getFailStackTrace();
final output = await session.getOutput();
print("FFmpeg process exited with state ${state} and rc ${returnCode}");
if (state == SessionState.failed || !ReturnCode.isSuccess(returnCode)) {
print("Command failed. Please check output for the details$output");
print("转码失败");
return Future.value({"code":false});
}else{
print("转码成功");
final file = File(newPath);
List<int> doubleList = file.readAsBytesSync().buffer.asInt16List();
//print("pcm数据---$doubleList");
file.delete();
return Future.value({"code":true,"sampleRate":44100,"data":doubleList,"mDataLen":doubleList.length});
}
Platform: iOS
Version:ffmpeg_kit_flutter_audio: 4.5.1-LTS
Source branch: main
crash log:
Loading ffmpeg-kit.
Loaded ffmpeg-kit-audio-arm64-4.5.1-lts-20220114
flutter: Loaded ffmpeg-kit-flutter-ios-audio-arm64-4.5.1-lts.
Input #0, mp3, from '/var/mobile/Containers/Data/Application/7CED271E-5BAD-4EEE-A814-19282368D3E8/Documents/music/当阳常志此心丹.mp3':
Metadata:
artist : null
Duration: 00:01:59.82, start: 0.025057, bitrate: 128 kb/s
Stream #0:0: Audio: mp3, 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
encoder : LAME3.98r
Side data:
replaygain: track gain - -5.700000, track peak - unknown, album gain - unknown, album peak - unknown,
[mp3float @ 0x101eb2ef0] The "sub_text_format" option is deprecated: Deprecated, does nothing
Stream mapping:
Stream #0:0 -> #0:0 (mp3 (mp3float) -> pcm_s16be (native))
Press [q] to stop, [?] for help
Output #0, s16be, to '/var/mobile/Containers/Data/Application/7CED271E-5BAD-4EEE-A814-19282368D3E8/Documents/music/当阳常志此心丹.pcm':
Metadata:
artist : null
encoder : Lavf59.10.100
Stream #0:0: Audio: pcm_s16be, 16000 Hz, mono, s16, 256 kb/s
Metadata:
encoder : Lavc59.15.102 pcm_s16be
Side data:
replaygain: track gain - -5.700000, track peak - unknown, album gain - unknown, album peak - unknown,
size= 0kB time=00:00:00.00 bitrate=N/A speed= 0x
size= 3743kB time=00:01:59.77 bitrate= 256.0kbits/s speed= 460x
video:0kB audio:3743kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
*** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[__NSCFString appendString:]: nil argument'
*** First throw call stack:
(0x1905d8d78 0x1a923d734 0x1906e35d0 0x19067ec20 0x19055c530 0x101682d74 0x100fe4620 0x100fe1064 0x108bf195c 0x108742130 0x108abeafc 0x1089ec214 0x1089eff6c 0x1905ee168 0x190572144 0x19056c8f0 0x19054afa0 0x19055e6b8 0x1ac5f8374 0x192ec3e88 0x192c455ec 0x100f9963c 0x101219ce4)
libc++abi: terminating with uncaught exception of type NSException
- thread Log callbacks for FFprobe includes the executionId of a previous async FFmpeg execution #1, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x00000001c7fd3b78 libsystem_kernel.dylib__pthread_kill + 8 libsystem_kernel.dylib
__pthread_kill:
-> 0x1c7fd3b78 <+8>: b.lo 0x1c7fd3b98 ; <+40>
0x1c7fd3b7c <+12>: pacibsp
0x1c7fd3b80 <+16>: stp x29, x30, [sp, #-0x10]!
0x1c7fd3b84 <+20>: mov x29, sp
Target 0: (Runner) stopped.
Lost connection to device.
What's the reason