{"record":{"id":"4f17d29cf9e5bd9b","repo":"mudler/LocalAI","slug":"ffmpeg-mux-empty-frames-n","errorCode":null,"errorMessage":"ffmpeg_mux: empty frames\\n","messagePattern":"ffmpeg_mux: empty frames\\\\n","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"backend/go/stablediffusion-ggml/cpp/gosd.cpp","lineNumber":1210,"sourceCode":"    // Interleave planar [ch0_samples..., ch1_samples...] → [ch0_s0, ch1_s0, ...]\n    for (uint64_t s = 0; s < frames; s++) {\n        for (uint32_t c = 0; c < channels; c++) {\n            float v = a->data[(size_t)c * frames + s];\n            fwrite(&v, sizeof(float), 1, f);\n        }\n    }\n    fclose(f);\n    return 0;\n}\n\n// Pipe raw RGB/RGBA frames to ffmpeg stdin and let it produce an MP4 at dst.\n// Uses fork+execvp to avoid shell interpretation of dst. When `audio` is\n// non-null, the audio waveform is staged to a temp WAV and added as a second\n// ffmpeg input so the final MP4 contains both video and AAC audio.\nstatic int ffmpeg_mux_raw_to_mp4(sd_image_t* frames, int num_frames, int fps,\n                                  const sd_audio_t* audio, const char* dst) {\n    if (num_frames <= 0 || !frames || !frames[0].data) {\n        fprintf(stderr, \"ffmpeg_mux: empty frames\\n\");\n        return 1;\n    }\n    int width = (int)frames[0].width;\n    int height = (int)frames[0].height;\n    int channels = (int)frames[0].channel;\n    const char* pix_fmt_in = (channels == 4) ? \"rgba\" : \"rgb24\";\n\n    char size_str[32];\n    char fps_str[32];\n    snprintf(size_str, sizeof(size_str), \"%dx%d\", width, height);\n    snprintf(fps_str, sizeof(fps_str), \"%d\", fps);\n\n    // Optional audio: write a temp WAV file if the model produced audio.\n    char wav_path[64] = {0};\n    bool have_audio = false;\n    if (audio && audio->data && audio->sample_count > 0 && audio->channels > 0 && audio->sample_rate > 0) {\n        if (write_planar_float_wav(audio, wav_path, sizeof(wav_path)) == 0) {\n            have_audio = true;","sourceCodeStart":1192,"sourceCodeEnd":1228,"githubUrl":"https://github.com/mudler/LocalAI/blob/44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26/backend/go/stablediffusion-ggml/cpp/gosd.cpp#L1192-L1228","documentation":"ffmpeg muxing was requested with no video frames. Guard: check the frame list is non-empty before invoking ffmpeg_mux; treat zero frames as a generation failure and report it.","triggerScenarios":"Thrown at backend/go/stablediffusion-ggml/cpp/gosd.cpp:1210 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the video generation produced frames before muxing; check earlier errors.","Verify generation parameters (frames, steps) are non-zero and valid."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"44413a9d06bf5bc52ce088ba8ca74e5a2e8bee26","analyzedAt":"2026-08-15T10:13:50.291Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}