Recorder docker error on export

When trying to export a timelapse using the Recorder docker, I get a popup saying

Export failed. FFmpeg message:
[fc#0 @ 000001e3821bf540] Error reinitializing filters!
[fc#0 @ 000001e3821bf540] Task finished with error code: -22 (Invalid argument)
[fc#0 @ 000001e3821bf540] Terminating thread with return code -22 (Invalid argument)
[vost#0:0/libx264 @ 000001e3821f7780] Could not open encoder before EOF
[vost#0:0/libx264 @ 000001e3821f7780] Task finished with error code: -22 (Invalid argument)
[vost#0:0/libx264 @ 000001e3821f7780] Terminating thread with return code -22 (Invalid argument)
Conversion failed!

The log file that gets created alongside the failed video says this:

C:/Users/millheat/Downloads/_Programs/ffmpeg-7.0-essentials_build/ffmpeg-7.0-essentials_build/bin/ffmpeg.exe -hide_banner -y -framerate 30 -i C:/Users/millheat/Videos/Krita Timelapses/test\20240422104333%07d.jpg -framerate 30 -start_number 65-1 -i C:/Users/millheat/Videos/Krita Timelapses/test\20240422104333%07d.jpg -filter_complex
[0]loop=530:size=1:start=65[main1];
[main1]scale=1920:1080[main2];
[main2]loop=1:size=1:start=0[main3];
[main3]setpts=PTS-STARTPTS[main4];
[1]split [first1][transition1];
[transition1]scale=1920:1080 [transition2];
[transition2]loop='if(gte(2, 1), 1
30, 0)':size=1:start=1[transition3];
[transition3]setpts=PTS-STARTPTS[transition4];
[transition4][main4]xfade=transition=smoothright:duration=0.5:offset=0[v1];
[v1]setpts=PTS-STARTPTS[v2];
[v2]trim=start_frame=1[v3];
[first1]loop=ā€˜if(gte(2, 1), (230) - 0.5, 230)’:size=1:start=1[preview1];
[preview1]scale=1920:1080[preview2];
[preview2]setpts=PTS-STARTPTS[preview3];
[preview3][v3] concat [final1];
[final1] setpts=PTS-STARTPTS[final2];
[final2] trim=start_frame=1
-c:v libx264 -r 30 -pix_fmt yuv420p C:/Users/millheat/Videos/Krita Timelapses/test\10.mp4


Input #0, image2, from ā€˜C:/Users/millheat/Videos/Krita Timelapses/test\20240422104333%07d.jpg’:
Duration: 00:00:02.17, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 96:96 DAR 16:9], 30 fps, 30 tbr, 30 tbn
Input #1, image2, from ā€˜C:/Users/millheat/Videos/Krita Timelapses/test\20240422104333%07d.jpg’:
Duration: 00:00:00.03, start: 0.000000, bitrate: N/A
Stream #1:0: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 1920x1080 [SAR 96:96 DAR 16:9], 30 fps, 30 tbr, 30 tbn
Stream mapping:
Stream #0:0 (mjpeg) → loop:default
Stream #1:0 (mjpeg) → split:default
trim:default → Stream #0:0 (libx264)
Press [q] to stop, [?] for help
[swscaler @ 000001e3827c5840] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 000001e38443c040] deprecated pixel format used, make sure you did set range correctly
[swscaler @ 000001e384ba9040] deprecated pixel format used, make sure you did set range correctly
[Parsed_xfade_8 @ 000001e3821f8b80] The inputs needs to be a constant frame rate; current rate of 1/0 is invalid
[Parsed_xfade_8 @ 000001e3821f8b80] Failed to configure output pad on Parsed_xfade_8
[fc#0 @ 000001e3821bf540] Error reinitializing filters!
[fc#0 @ 000001e3821bf540] Task finished with error code: -22 (Invalid argument)
[fc#0 @ 000001e3821bf540] Terminating thread with return code -22 (Invalid argument)
[vost#0:0/libx264 @ 000001e3821f7780] Could not open encoder before EOF
[vost#0:0/libx264 @ 000001e3821f7780] Task finished with error code: -22 (Invalid argument)
[vost#0:0/libx264 @ 000001e3821f7780] Terminating thread with return code -22 (Invalid argument)
[out#0/mp4 @ 000001e3821c1bc0] Nothing was written into output file, because at least one of its streams received no packets.
frame= 0 fps=0.0 q=0.0 Lsize= 0KiB time=N/A bitrate=N/A speed=N/A
Conversion failed!

Specs:
Krita 5.2.2
ffmpeg linked (ffmpeg-7.0-essentials_build)
Windows 11
Precision 5680

The issue seems to be the ā€œcurrent rate of 1/0 is invalidā€? But I don’t know where or how to fix that.

I’ve tested creating an animation and it exports using ffmpeg with no issue, only the recorder seems to have a problem.

What could be causing the recorder to fail?

1 Like

:slight_smile: Hello @hmiller61615 and welcome to the forum!

The issue will most likely be the version of FFmpeg you installed.
But I’m a bit puzzled why you installed FFmpeg for Krita 5.2.2, a version that comes with its own FFmpeg?
Please go to Gyan.dev and download the ffmpeg-6.1.1-essentials_build.zip or /.7Z and use that instead of version 7.x which has an issue.

https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-6.1.1-essentials_build.zip

https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-6.1.1-essentials_build.7z

Michelist

2 Likes

There’s a MR over here that should fix this, though it hasn’t been tested with your (7.0) version of ffmpeg.
Either way it should theoretically be more stable, next to the ā€˜Render as MP4’ can you click the edit pencil icon, and replace the entirety of that text box with this and give it a test?

-reinit_filter 0
-framerate $IN_FPS
-i "$INPUT_DIR%07d.$EXT"
-filter_complex "
 [0]scale='min($WIDTH, iw*($HEIGHT/ih))':'min($HEIGHT, ih*($WIDTH/iw))':eval=frame[in1];
 [in1]pad=$WIDTH:$HEIGHT:(ow-iw)/2:(oh-ih)/2:eval=frame[in2];
 [in2]format=yuv420p[in3];
 [in3]split=4[main1][preview1][transition1][end1];
 [transition1]trim=start_frame=$FRAMES-1,tpad=stop_mode=clone:stop_duration=1[transition2];
 [transition2]setpts=PTS-STARTPTS[transition3];
 [transition3][main1]xfade=transition=smoothright:duration=1:offset=0[main2];
 [end1]trim=start_frame=$FRAMES-1,tpad=stop_mode=clone:stop_duration=$LAST_FRAME_SEC[end2];
 [end2]setpts=PTS-STARTPTS[end3];
 [preview1]trim=start_frame=$FRAMES-1,tpad=stop_mode=clone:stop_duration=$FIRST_FRAME_SEC[preview2];
 [preview2]setpts=PTS-STARTPTS[preview3];
 [preview3][main2][end3]concat=n=3:v=1:a=0[final1];
 [final1]setpts=PTS-STARTPTS;
"
-c:v libx264
-r $OUT_FPS
-pix_fmt yuv420p
2 Likes

Probably because Krita’s build in ffmpeg doesn’t support the proprietary h264 codec?

1 Like

It could be an encoder issue, but I feel like ffmpeg would throw an error long before it got a filter reinit stage. The error ā€œThe inputs needs to be a constant frame rate; current rate of 1/0 is invalidā€ sounds like it’s trying to output a video of length 0, which would be entirely possible with how many PTS issues the last ffmpeg export code had and how short their animation is (65 frames)

This error is an issue with FFmpeg 7. This will work:

-i "$INPUT_DIR%07d.$EXT"
-framerate $IN_FPS
-start_number $FRAMES-1
-i "$INPUT_DIR%07d.$EXT"
-filter_complex "
 [0]loop=$LAST_FRAME_SEC*$IN_FPS:size=1:start=$FRAMES[main1];
 [main1]scale=$WIDTH:$HEIGHT[main2];
 [main2]loop=1:size=1:start=0[main3];
 [main3]setpts=PTS-STARTPTS[main4];
 [main4]framerate=fps=$IN_FPS[main5];
 [1]split [first1][transition1];
 [transition1]scale=$WIDTH:$HEIGHT [transition2];
 [transition2]loop='if(gte($FIRST_FRAME_SEC, 1), 1*$IN_FPS, 0)':size=1:start=1[transition3];
 [transition3]setpts=PTS-STARTPTS[transition4];
 [transition4]framerate=fps=$IN_FPS[transition5];
 [transition5][main5]xfade=transition=smoothright:duration=0.5:offset=0[v1];
 [v1]setpts=PTS-STARTPTS[v2];
 [v2]trim=start_frame=1[v3];
 [first1]loop='if(gte($FIRST_FRAME_SEC, 1), ($FIRST_FRAME_SEC*$IN_FPS) - 0.5*$IN_FPS, $FIRST_FRAME_SEC*$IN_FPS)':size=1:start=1[preview1];
 [preview1]scale=$WIDTH:$HEIGHT[preview2];
 [preview2]setpts=PTS-STARTPTS[preview3];
 [preview3][v3] concat [final1];
 [final1] setpts=PTS-STARTPTS[final2];
 [final2] trim=start_frame=1
"
-c:v h264
-r $OUT_FPS
-pix_fmt yuv420p

See this thread Timelapse Export Failed - #16 by Reinold

3 Likes

That would be a very good reason if you absolutely need this codec, I’m probably too undemanding and make do with the GPL-compatible codecs.

Michelist

Perfect!

Yes, this fixed it, going back to that previous version of FFmpeg instead of using 7. The timelapse exported with no issues.

I tried to use the FFmpeg that came with Krita, but got the error ā€œExport failed. FFmpeg message:ā€ and then no message. That prompted me to look into the essentials build, but I guess the newest version isn’t compatible yet.

Thank you! This has been solved.

2 Likes

I am happy to hear that we were able to help you.

Michelist

1 Like

This topic was automatically closed 4 days after the last reply. New replies are no longer allowed.