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.53k stars 603 forks source link

Missing log output on async call #800

Closed Christilut closed 1 year ago

Christilut commented 1 year ago

I'm segmenting audio with ffmpeg with a command like this -i <input> -loglevel verbose -muxdelay 0 -map_metadata -1 -f segment -segment_time 10 <output>

The command works in both sync and async calls. But when running it sync, I get output like this:

[segment @ 0x7fc3dc00d400] Opening '/.audio_cache/8196858c-3b1f-4611-9c04-4f9c1b767b38_0001.wav' for writing
[segment @ 0x7fc3dc00d400] segment:'/.audio_cache/8196858c-3b1f-4611-9c04-4f9c1b767b38_0001.wav' starts with packet stream:0 pts:441728 pts_time:10.0165 frame:384
[segment @ 0x7fc3dc00d400] segment:'/.audio_cache/8196858c-3b1f-4611-9c04-4f9c1b767b38_0001.wav' count:1 ended

When I use the executeAsync command, with the withLogCallback then the above output is not there. Some basic streaming info output is there but nothing more.

Is the loglevel being ignored for the async command or is something else going on? How do I get all the log output?

Christilut commented 1 year ago

Here is my basic code:

        FFmpegKit.executeAsync(ffmpegCommand) { session in
            guard let session = session else {
                print("!! Invalid session")
                return
            }

            guard let returnCode = session.getReturnCode() else {
                print("!! Invalid return code")
                return
            }

            print("FFmpeg process exited with state \(FFmpegKitConfig.sessionState(toString: session.getState()) ?? "Unknown") and rc \(returnCode).\(session.getFailStackTrace() ?? "Unknown")")
        } withLogCallback: { logs in
            guard logs != nil else { return }

            print(logs)
        } withStatisticsCallback: { stats in
            guard stats != nil else { return }
        }