lay295 / TwitchDownloader

Twitch VOD/Clip Downloader - Chat Download/Render/Replay
MIT License
2.68k stars 261 forks source link

ERROR: Failed to finalize video (code -1094995529) #1121

Closed vilapupu closed 3 months ago

vilapupu commented 3 months ago

Checklist

Edition

Windows GUI Application

Describe your issue here

Since I updated to v 1.54.6 I've been constantly getting this same message. The video starts to download and then it keeps trying to finalize but it just fails. I don't know why this happens, I Just find it extremely annoying.

Quality 720p30p Trim Mode; Exact Trim: start 0 5 0 End: 5 5 0

Add any related files or extra information here

ERROR: Failed to finalize video (code -1094995529), retrying in 10 seconds... ERROR: Failed to finalize video (code -1094995529), retrying in 10 seconds... ERROR: Failed to finalize video. The download cache has not been cleared and can be found at C:\Users\USER\AppData\Local\Temp\TwitchDownloader\2173146150_638553451101768515 along with a log file.

powercrystal commented 3 months ago

having the same issue.

portalq commented 3 months ago

Can confirm, having the same issue. I switched back to the previous version and it fixed the issue for me.

boma33 commented 3 months ago

Can also confirm this issue, will do what previous commenter said and switch to the previous release.

ScrubN commented 3 months ago

Someone please post the log file

ScrubN commented 3 months ago

I have successfully reproduced the issue and found a workaround.

A hotfix will be released soon.

ScrubN commented 3 months ago

For future reference, the issue seems to be some VODs contain bad audio packets which FFmpeg really doesn't like when running in copy mode. Re-encoding the audio seems to fix it.

FFmpeg output

``` ffmpeg version git-2020-08-31-4a11a6f Copyright (c) 2000-2020 the FFmpeg developers built with gcc 10.2.1 (GCC) 20200805 configuration: --enable-gpl --enable-version3 --enable-sdl2 --enable-fontconfig --enable-gnutls --enable-iconv --enable-libass --enable-libdav1d --enable-libbluray --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libopus --enable-libshine --enable-libsnappy --enable-libsoxr --enable-libsrt --enable-libtheora --enable-libtwolame --enable-libvpx --enable-libwavpack --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libzimg --enable-lzma --enable-zlib --enable-gmp --enable-libvidstab --enable-libvmaf --enable-libvorbis --enable-libvo-amrwbenc --enable-libmysofa --enable-libspeex --enable-libxvid --enable-libaom --enable-libgsm --enable-librav1e --enable-libsvtav1 --disable-w32threads --enable-libmfx --enable-ffnvcodec --enable-cuda-llvm --enable-cuvid --enable-d3d11va --enable-nvenc --enable-nvdec --enable-dxva2 --enable-avisynth --enable-libopenmpt --enable-amf libavutil 56. 58.100 / 56. 58.100 libavcodec 58.101.101 / 58.101.101 libavformat 58. 51.101 / 58. 51.101 libavdevice 58. 11.101 / 58. 11.101 libavfilter 7. 87.100 / 7. 87.100 libswscale 5. 8.100 / 5. 8.100 libswresample 3. 8.100 / 3. 8.100 libpostproc 55. 8.100 / 55. 8.100 Input #0, concat, from 'D:\TwitchDownloaderCache\TwitchDownloader\2173146150_638553579323348452\concat.txt': Duration: 05:00:50.48, start: 0.000000, bitrate: 0 kb/s Stream #0:0: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 50 kb/s Stream #0:1: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, progressive), 284x160, 30 fps, 30 tbr, 90k tbn, 60 tbc Stream #0:2: Data: timed_id3 (ID3 / 0x20334449) Input #1, ffmetadata, from 'D:\TwitchDownloaderCache\TwitchDownloader\2173146150_638553579323348452\metadata.txt': Metadata: title : 🎁🎉🎈CELEBRANDO MI CUMPLEEEEE 🎁🎉🎈 | !redes !pc !kofi (2173146150) artist : Kypirinha date : 2024 comment : cum : ------------------------ : Originally aired: 2024-06-16 00:01:29Z : Video id: 2173146150 : Views: 721 Duration: 05:00:50.00, start: 0.000000, bitrate: N/A Chapter #1:0: start -300.000000, end 6398.000000 Metadata: title : Special Events Chapter #1:1: start 6398.000000, end 13299.000000 Metadata: title : Just Chatting Chapter #1:2: start 13299.000000, end 15748.000000 Metadata: title : Music Chapter #1:3: start 15748.000000, end 16079.000000 Metadata: title : Just Chatting Chapter #1:4: start 16079.000000, end 17870.000000 Metadata: title : Music Chapter #1:5: start 17870.000000, end 18050.000000 Metadata: title : Just Chatting Output #0, mp4, to 'D:\Archive\[6-15-24] Kypirinha - 🎁🎉🎈CELEBRANDO MI CUMPLEEEEE 🎁🎉🎈 | !redes !pc !kofi.mp4': Metadata: title : 🎁🎉🎈CELEBRANDO MI CUMPLEEEEE 🎁🎉🎈 | !redes !pc !kofi (2173146150) artist : Kypirinha date : 2024 comment : cum : ------------------------ : Originally aired: 2024-06-16 00:01:29Z : Video id: 2173146150 : Views: 721 encoder : Lavf58.51.101 Chapter #0:0: start 0.000000, end 6398.000000 Metadata: title : Special Events Chapter #0:1: start 6398.000000, end 13299.000000 Metadata: title : Just Chatting Chapter #0:2: start 13299.000000, end 15748.000000 Metadata: title : Music Chapter #0:3: start 15748.000000, end 16079.000000 Metadata: title : Just Chatting Chapter #0:4: start 16079.000000, end 17870.000000 Metadata: title : Music Chapter #0:5: start 17870.000000, end 18050.000000 Metadata: title : Just Chatting Stream #0:0: Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, progressive), 284x160, q=2-31, 30 fps, 30 tbr, 90k tbn, 90k tbc Stream #0:1: Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 50 kb/s Stream mapping: Stream #0:1 -> #0:0 (copy) Stream #0:0 -> #0:1 (copy) Press [q] to stop, [?] for help frame=24300 fps=0.0 q=-1.0 size= 20736kB time=00:13:30.00 bitrate= 209.7kbits/s speed=1.61e+03x [mpegts @ 0000026bcec68640] Packet corrupt (stream = 1, dts = 136253970). [aac_adtstoasc @ 0000026bceae9fc0] Error parsing ADTS frame header! [mp4 @ 0000026bcec07580] Error applying bitstream filters to an output packet for stream #1: Invalid data found when processing input av_interleaved_write_frame(): Invalid data found when processing input frame=34200 fps=0.0 q=-1.0 Lsize= 31593kB time=00:18:59.98 bitrate= 227.0kbits/s speed=1.6e+03x video:23560kB audio:7045kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.229315% Conversion failed! ```

superbonaci commented 3 months ago

@ScrubN do you have any VOD that is still online and has bad audio packets? I could test and send a bug report.

ScrubN commented 2 months ago

It is very likely that this issue was caused by muted segments in the VOD (when twitch mutes segments, the stream mapping order gets messed up), meaning it would has been properly fixed by #1141. If that was the case, then the issue with FFmpeg is not bad audio packets, but rather that FFmpeg naively assumes the stream mapping order doesn't ever change when concatenating with an ffconcat list that doesn't explicitly define stream mappings. I don't think its worth reporting though as it would likely get marked as intended behavior.