cmuche / octoprint-timelapseplus

Timelapse+ is a powerful yet lightweight plugin to stabilize, capture, enhance and render your print timelapses.
https://plugins.octoprint.org/plugins/timelapseplus
26 stars 4 forks source link

ffmpeg 6 render failed #66

Closed fly74 closed 1 year ago

fly74 commented 1 year ago

Hi Chris. I updated ffmpeg to version 6.

The rendering seems to be processed but failed.

Screenshot 2023-05-16 075452 Screenshot 2023-05-16 075459

where can I see the commandline which is used to render the pics?

cmuche commented 1 year ago

Hi @fly74 As I can see FFmpeg doesn't crash immediately. What OS are you using? On a Linux system you can take a look in the process list via top or htop while FFmpeg is running.

fly74 commented 1 year ago

You're right missed to check ps. The line is:

ffmpeg -y -framerate 30 -i %05d.jpg -r 30 -qscale:v 1 F_%05d.jpg -hide_banner -loglevel verbose -progress pipe:1 -nostats

How the loop for the pictures build?

OS: Opensuse Leap 15.4 - ffmpeg from GIT v6

fly74 commented 1 year ago

You're right missed to check ps. The line is:

ffmpeg -y -framerate 30 -i %05d.jpg -r 30 -qscale:v 1 F_%05d.jpg -hide_banner -loglevel verbose -progress pipe:1 -nostats

How the loop for the pictures build?

OS: Opensuse Leap 15.4 - ffmpeg from GIT v6

This line has no error all F_*.jpg are made.

...
[AVIOContext @ 0x7fa758003540] Statistics: 272091 bytes written, 0 seeks, 2 writeouts
[AVIOContext @ 0x7fa76c051d00] Statistics: 289551 bytes read, 0 seeks
[AVIOContext @ 0x7fa758003b80] Statistics: 269970 bytes written, 0 seeks, 2 writeouts
[AVIOContext @ 0x7fa76c051d00] Statistics: 290593 bytes read, 0 seeks
[AVIOContext @ 0x7fa758003540] Statistics: 272266 bytes written, 0 seeks, 2 writeouts
[AVIOContext @ 0x7fa76c004680] Statistics: 292158 bytes read, 0 seeks
[AVIOContext @ 0x7fa758003b80] Statistics: 271773 bytes written, 0 seeks, 2 writeouts
[in#0/image2 @ 0x2301d00] EOF while reading input
[in#0/image2 @ 0x2301d00] Terminating demuxer thread
[AVIOContext @ 0x7fa758003540] Statistics: 269933 bytes written, 0 seeks, 2 writeouts
No more output streams to write to, finishing.
[AVIOContext @ 0x7fa758003540] Statistics: 268606 bytes written, 0 seeks, 2 writeouts
[AVIOContext @ 0x7fa758003c80] Statistics: 269035 bytes written, 0 seeks, 2 writeouts
[AVIOContext @ 0x7fa758003540] Statistics: 271076 bytes written, 0 seeks, 2 writeouts
[out#0/image2 @ 0x2315100] All streams finished
[out#0/image2 @ 0x2315100] Terminating muxer thread
[out#0/image2 @ 0x2315100] Output file #0 (F_%05d.jpg):
[out#0/image2 @ 0x2315100]   Output stream #0:0 (video): 313 frames encoded; 313 packets muxed (85328643 bytes);
[out#0/image2 @ 0x2315100]   Total: 313 packets (85328643 bytes) muxed
[out#0/image2 @ 0x2315100] video:83329kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
frame=  313 fps= 45 q=1.0 Lsize=N/A time=00:00:10.40 bitrate=N/A speed=1.49x
frame=313
fps=44.92
stream_0_0_q=1.0
bitrate=N/A
total_size=N/A
out_time_us=10400000
out_time_ms=10400000
out_time=00:00:10.400000
dup_frames=0
drop_frames=0
speed=1.49x
progress=end
[AVIOContext @ 0x2301b40] Statistics: 2814 bytes written, 0 seeks, 15 writeouts
[in#0/image2 @ 0x2301d00] Input file #0 (%05d.jpg):
[in#0/image2 @ 0x2301d00]   Input stream #0:0 (video): 313 packets read (92675790 bytes); 313 frames decoded;
[in#0/image2 @ 0x2301d00]   Total: 313 packets (92675790 bytes) demuxed
cmuche commented 1 year ago

Is it the output from when you tried to run the command mynually or the OctoPrint log? Can't see any error there... I'll give it a try myself with FFmpeg 6. Maybe I can reproduce it. Could you maybe upload your used Frame Collection for that? Does your machine have sufficient memory? Maybe your disk and/or RAM is running full. Especially the rendering process can take quite some disk space.

fly74 commented 1 year ago

Disk >900GB free, memory and CPU is sufficient it's an Intel NUC. That was from my commandline. No logs of octoprint are containing ffmpeg. I see the generation of the F_*.jpg pics on the disk and then they are deleted immediately. You can use any collection of images. All of mine don't work. Is there a debug log to enable for the plugin output?

fly74 commented 1 year ago

octoprint.log only this:

octoprint.log:|  Timelapse+ (1.2.1) = ~/OctoPrint/venv/lib/python3.10/site-packages/octoprint_timelapseplus
octoprint.log:2023-05-16 18:04:59,458 - octoprint.plugins.timelapseplus - WARNING - The Blueprint of this plugin is relying on the default implementation of is_blueprint_csrf_protected (newly added in OctoPrint 1.8.3), which in a future version will be switched from False to True for security reasons. Plugin authors should ensure they explicitly declare the CSRF protection status in their BlueprintPlugin mixin implementation. Recommendation is to enable CSRF protection and exempt views that must not use it with the octoprint.plugin.BlueprintPlugin.csrf_exempt decorator.
octoprint.log:2023-05-16 18:04:59,458 - octoprint.server - WARNING - CSRF Protection for Blueprint of plugin timelapseplus is DISABLED
octoprint.log:2023-05-16 18:05:02,941 - octoprint.plugins.timelapseplus - INFO - Downloaded Snapshot to ~/.octoprint/data/timelapseplus/webcam-tmp/NEH9J292IDOU3D9PG2QWBJGNO745DPSH.jpg
octoprint.log:|  Timelapse+ (1.2.1) = ~/OctoPrint/venv/lib/python3.10/site-packages/octoprint_timelapseplus
octoprint.log:2023-05-16 18:05:56,509 - octoprint.plugins.timelapseplus - WARNING - The Blueprint of this plugin is relying on the default implementation of is_blueprint_csrf_protected (newly added in OctoPrint 1.8.3), which in a future version will be switched from False to True for security reasons. Plugin authors should ensure they explicitly declare the CSRF protection status in their BlueprintPlugin mixin implementation. Recommendation is to enable CSRF protection and exempt views that must not use it with the octoprint.plugin.BlueprintPlugin.csrf_exempt decorator.
octoprint.log:2023-05-16 18:05:56,509 - octoprint.server - WARNING - CSRF Protection for Blueprint of plugin timelapseplus is DISABLED
octoprint.log:2023-05-16 18:05:59,226 - octoprint.plugins.timelapseplus - INFO - Downloaded Snapshot to ~/.octoprint/data/timelapseplus/webcam-tmp/ALYFI2GXWMA0Z0HRYDQN2W7E5VCWOEUW.jpg
cmuche commented 1 year ago

I just pushed a solution which logs the FFmpeg output to a file. Could you maybe install this version and try out again? https://github.com/cmuche/octoprint-timelapseplus/archive/refs/heads/66-ffmpeg-6-render-failed.zip

Then you should get a ffmpeg_log.txt in your timelapse folder. If FFmpeg crashes, you'll also get the output as a notification in your browser. This should help to identify the error.

fly74 commented 1 year ago

Then you should get a ffmpeg_log.txt in your timelapse folder.

That should be a hint:

Unrecognized option 'crf'.
Error splitting the argument list: Option not found
fly74 commented 1 year ago

Can you give me final render ffmpeg command for the pics, so I can play around.

cmuche commented 1 year ago

Hi @fly74

The Unrecognized option 'crf'. error is confusing since this is only used in the 'Encoding' phase, not the 'Rendering' phase as your first screenshot shows. Also your tested command is the one from the 'Rendering' phase. Timelapse+ uses FFmpeg twice in its rendering pipeline.

But first of all: What version of Timelapse+ are you using?

Could it be that your FFmpeg version doesn't include libx264? You can run ffmpeg -encoders to see which encoders are available. Assuming you are using a Timelapse+ version >= 1.1.0: Are you able to render in other Format Presets?

fly74 commented 1 year ago
ffmpeg -encoders
ffmpeg version N-110642-g6b2ae90411 Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 7 (SUSE Linux)
  configuration:
  libavutil      58.  7.100 / 58.  7.100
  libavcodec     60. 12.100 / 60. 12.100
  libavformat    60.  5.100 / 60.  5.100
  libavdevice    60.  2.100 / 60.  2.100
  libavfilter     9.  8.100 /  9.  8.100
  libswscale      7.  2.100 /  7.  2.100
  libswresample   4. 11.100 /  4. 11.100
Encoders:
 V..... = Video
 A..... = Audio
 S..... = Subtitle
 .F.... = Frame-level multithreading
 ..S... = Slice-level multithreading
 ...X.. = Codec is experimental
 ....B. = Supports draw_horiz_band
 .....D = Supports direct rendering method 1
 ------
 V....D a64multi             Multicolor charset for Commodore 64 (codec a64_multi)
 V....D a64multi5            Multicolor charset for Commodore 64, extended with 5th color (colram) (codec a64_multi5)
 V....D alias_pix            Alias/Wavefront PIX image
 V..... amv                  AMV Video
 V....D apng                 APNG (Animated Portable Network Graphics) image
 V....D asv1                 ASUS V1
 V....D asv2                 ASUS V2
 V....D avrp                 Avid 1:1 10-bit RGB Packer
 V..X.D avui                 Avid Meridien Uncompressed
 V....D ayuv                 Uncompressed packed MS 4:4:4:4
 VF...D bitpacked            Bitpacked
 V....D bmp                  BMP (Windows and OS/2 bitmap)
 VF...D cfhd                 GoPro CineForm HD
 V....D cinepak              Cinepak
 V....D cljr                 Cirrus Logic AccuPak
 V.S..D vc2                  SMPTE VC-2 (codec dirac)
 VFS..D dnxhd                VC3/DNxHD
 V....D dpx                  DPX (Digital Picture Exchange) image
 VFS..D dvvideo              DV (Digital Video)
 VF...D exr                  OpenEXR image
 V.S..D ffv1                 FFmpeg video codec #1
 VF...D ffvhuff              Huffyuv FFmpeg variant
 V....D fits                 Flexible Image Transport System
 V....D flashsv              Flash Screen Video
 V....D flashsv2             Flash Screen Video Version 2
 V..... flv                  FLV / Sorenson Spark / Sorenson H.263 (Flash Video) (codec flv1)
 V....D gif                  GIF (Graphics Interchange Format)
 V..... h261                 H.261
 V..... h263                 H.263 / H.263-1996
 V..... h263_v4l2m2m         V4L2 mem2mem H.263 encoder wrapper (codec h263)
 V.S... h263p                H.263+ / H.263-1998 / H.263 version 2
 V..... h264_v4l2m2m         V4L2 mem2mem H.264 encoder wrapper (codec h264)
 VF...D hdr                  HDR (Radiance RGBE format) image
 V..... hevc_v4l2m2m         V4L2 mem2mem HEVC encoder wrapper (codec hevc)
 VF...D huffyuv              Huffyuv / HuffYUV
 VF...D jpeg2000             JPEG 2000
 VF...D jpegls               JPEG-LS
 VF...D ljpeg                Lossless JPEG
 VF...D magicyuv             MagicYUV video
 VFS... mjpeg                MJPEG (Motion JPEG)
 V.S... mpeg1video           MPEG-1 video
 V.S... mpeg2video           MPEG-2 video
 V.S... mpeg4                MPEG-4 part 2
 V..... mpeg4_v4l2m2m        V4L2 mem2mem MPEG4 encoder wrapper (codec mpeg4)
 V..... msmpeg4v2            MPEG-4 part 2 Microsoft variant version 2
 V..... msmpeg4              MPEG-4 part 2 Microsoft variant version 3 (codec msmpeg4v3)
 V..... msvideo1             Microsoft Video-1
 V....D pam                  PAM (Portable AnyMap) image
 V....D pbm                  PBM (Portable BitMap) image
 V....D pcx                  PC Paintbrush PCX image
 V....D pfm                  PFM (Portable FloatMap) image
 V....D pgm                  PGM (Portable GrayMap) image
 V....D pgmyuv               PGMYUV (Portable GrayMap YUV) image
 V....D phm                  PHM (Portable HalfFloatMap) image
 VF...D png                  PNG (Portable Network Graphics) image
 V....D ppm                  PPM (Portable PixelMap) image
 VF...D prores               Apple ProRes
 VF...D prores_aw            Apple ProRes (codec prores)
 VFS... prores_ks            Apple ProRes (iCodec Pro) (codec prores)
 VF...D qoi                  QOI (Quite OK Image format) image
 V....D qtrle                QuickTime Animation (RLE) video
 V....D r10k                 AJA Kona 10-bit RGB Codec
 V....D r210                 Uncompressed RGB 10-bit
 VF...D rawvideo             raw video
 V....D roqvideo             id RoQ video (codec roq)
 V....D rpza                 QuickTime video (RPZA)
 V..... rv10                 RealVideo 1.0
 V..... rv20                 RealVideo 2.0
 V....D sgi                  SGI image
 V....D smc                  QuickTime Graphics (SMC)
 V....D snow                 Snow
 V..... speedhq              NewTek SpeedHQ
 V....D sunrast              Sun Rasterfile image
 V....D svq1                 Sorenson Vector Quantizer 1 / Sorenson Video 1 / SVQ1
 V....D targa                Truevision Targa image
 VF...D tiff                 TIFF image
 VF...D utvideo              Ut Video
 VF...D v210                 Uncompressed 4:2:2 10-bit
 V....D v308                 Uncompressed packed 4:4:4
 V....D v408                 Uncompressed packed QT 4:4:4:4
 V....D v410                 Uncompressed 4:4:4 10-bit
 V.S..D vbn                  Vizrt Binary Image
 V..... vnull                null video
 V..... vp8_v4l2m2m          V4L2 mem2mem VP8 encoder wrapper (codec vp8)
 VF...D wbmp                 WBMP (Wireless Application Protocol Bitmap) image
 V..... wmv1                 Windows Media Video 7
 V..... wmv2                 Windows Media Video 8
 V..... wrapped_avframe      AVFrame to AVPacket passthrough
 V....D xbm                  XBM (X BitMap) image
 V....D xface                X-face image
 V....D xwd                  XWD (X Window Dump) image
 V....D y41p                 Uncompressed YUV 4:1:1 12-bit
 V....D yuv4                 Uncompressed packed 4:2:0
 VF...D zlib                 LCL (LossLess Codec Library) ZLIB
 V....D zmbv                 Zip Motion Blocks Video
 A....D aac                  AAC (Advanced Audio Coding)
 A....D ac3                  ATSC A/52A (AC-3)
 A....D ac3_fixed            ATSC A/52A (AC-3) (codec ac3)
 A....D adpcm_adx            SEGA CRI ADX ADPCM
 A....D adpcm_argo           ADPCM Argonaut Games
 A....D g722                 G.722 ADPCM (codec adpcm_g722)
 A....D g726                 G.726 ADPCM (codec adpcm_g726)
 A....D g726le               G.726 little endian ADPCM ("right-justified") (codec adpcm_g726le)
 A....D adpcm_ima_alp        ADPCM IMA High Voltage Software ALP
 A....D adpcm_ima_amv        ADPCM IMA AMV
 A....D adpcm_ima_apm        ADPCM IMA Ubisoft APM
 A....D adpcm_ima_qt         ADPCM IMA QuickTime
 A....D adpcm_ima_ssi        ADPCM IMA Simon & Schuster Interactive
 A....D adpcm_ima_wav        ADPCM IMA WAV
 A....D adpcm_ima_ws         ADPCM IMA Westwood
 A....D adpcm_ms             ADPCM Microsoft
 A....D adpcm_swf            ADPCM Shockwave Flash
 A....D adpcm_yamaha         ADPCM Yamaha
 A....D alac                 ALAC (Apple Lossless Audio Codec)
 A..... anull                null audio
 A....D aptx                 aptX (Audio Processing Technology for Bluetooth)
 A....D aptx_hd              aptX HD (Audio Processing Technology for Bluetooth)
 A....D comfortnoise         RFC 3389 comfort noise generator
 A....D dfpwm                DFPWM1a audio
 A..X.D dca                  DCA (DTS Coherent Acoustics) (codec dts)
 A....D eac3                 ATSC A/52 E-AC-3
 A....D flac                 FLAC (Free Lossless Audio Codec)
 A....D g723_1               G.723.1
 A..X.D mlp                  MLP (Meridian Lossless Packing)
 A....D mp2                  MP2 (MPEG audio layer 2)
 A....D mp2fixed             MP2 fixed point (MPEG audio layer 2) (codec mp2)
 A....D nellymoser           Nellymoser Asao
 A..X.D opus                 Opus
 A....D pcm_alaw             PCM A-law / G.711 A-law
 A....D pcm_bluray           PCM signed 16|20|24-bit big-endian for Blu-ray media
 A....D pcm_dvd              PCM signed 16|20|24-bit big-endian for DVD media
 A....D pcm_f32be            PCM 32-bit floating point big-endian
 A....D pcm_f32le            PCM 32-bit floating point little-endian
 A....D pcm_f64be            PCM 64-bit floating point big-endian
 A....D pcm_f64le            PCM 64-bit floating point little-endian
 A....D pcm_mulaw            PCM mu-law / G.711 mu-law
 A....D pcm_s16be            PCM signed 16-bit big-endian
 A....D pcm_s16be_planar     PCM signed 16-bit big-endian planar
 A....D pcm_s16le            PCM signed 16-bit little-endian
 A....D pcm_s16le_planar     PCM signed 16-bit little-endian planar
 A....D pcm_s24be            PCM signed 24-bit big-endian
 A....D pcm_s24daud          PCM D-Cinema audio signed 24-bit
 A....D pcm_s24le            PCM signed 24-bit little-endian
 A....D pcm_s24le_planar     PCM signed 24-bit little-endian planar
 A....D pcm_s32be            PCM signed 32-bit big-endian
 A....D pcm_s32le            PCM signed 32-bit little-endian
 A....D pcm_s32le_planar     PCM signed 32-bit little-endian planar
 A....D pcm_s64be            PCM signed 64-bit big-endian
 A....D pcm_s64le            PCM signed 64-bit little-endian
 A....D pcm_s8               PCM signed 8-bit
 A....D pcm_s8_planar        PCM signed 8-bit planar
 A....D pcm_u16be            PCM unsigned 16-bit big-endian
 A....D pcm_u16le            PCM unsigned 16-bit little-endian
 A....D pcm_u24be            PCM unsigned 24-bit big-endian
 A....D pcm_u24le            PCM unsigned 24-bit little-endian
 A....D pcm_u32be            PCM unsigned 32-bit big-endian
 A....D pcm_u32le            PCM unsigned 32-bit little-endian
 A....D pcm_u8               PCM unsigned 8-bit
 A....D pcm_vidc             PCM Archimedes VIDC
 A....D real_144             RealAudio 1.0 (14.4K) (codec ra_144)
 A....D roq_dpcm             id RoQ DPCM
 A..X.D s302m                SMPTE 302M
 A....D sbc                  SBC (low-complexity subband codec)
 A..X.D sonic                Sonic
 A..X.D sonicls              Sonic lossless
 A..X.D truehd               TrueHD
 A....D tta                  TTA (True Audio)
 A..X.D vorbis               Vorbis
 A....D wavpack              WavPack
 A....D wmav1                Windows Media Audio 1
 A....D wmav2                Windows Media Audio 2
 S..... ssa                  ASS (Advanced SubStation Alpha) subtitle (codec ass)
 S..... ass                  ASS (Advanced SubStation Alpha) subtitle
 S..... dvbsub               DVB subtitles (codec dvb_subtitle)
 S..... dvdsub               DVD subtitles (codec dvd_subtitle)
 S..... mov_text             3GPP Timed Text subtitle
 S..... srt                  SubRip subtitle (codec subrip)
 S..... subrip               SubRip subtitle
 S..... text                 Raw text subtitle
 S..... ttml                 TTML subtitle
 S..... webvtt               WebVTT subtitle
 S..... xsub                 DivX subtitles (XSUB)
fly74 commented 1 year ago

Only MP4 and WEBM can't be rendered, the other formats are working.

cmuche commented 1 year ago

Okay... Now I guess I see what the problem is: Your FFmpeg doesn't have the needed encoders:

See: https://superuser.com/a/1641500

fly74 commented 1 year ago

Ok I compiled it with

ffmpeg: ./configure --enable-libx264 --enable-gpl

and it is working. My fault. But can you make an encoder check before encoding?

Thanks for you research with me.

cmuche commented 1 year ago

@fly74

Checking for the installed encoders would be possible. I can add this to the backlog and get on that in the future.