Sorrow446 / Nugs-Downloader

Nugs downloader written in Go.
92 stars 15 forks source link

Failed to put TS into MP4 container. #44

Open jrdean opened 2 months ago

jrdean commented 2 months ago

A small number of videos fail to convert into mp4.

This is one example: https://play.nugs.net/release/26012

This was the input. ./main https://play.nugs.net/release/26012 --force-video

The full ts file downloads. This is output immedately when when the ts completes and ffmpeg should confert to mp4.

Item 1 of 1: 29.970 FPS, 4965 Kbps, 1080p (1920x1080) 100% @ 32 MB/s, 1.6 GB/1.6 GB Putting into MP4 container... Failed to put TS into MP4 container. Item failed. exit status 1 Input #0, mpegts, from 'completed/Joan Jett And The Blackhearts - 10_08_83 The Summit, Houston, TX_1080p.ts': Duration: 00:47:00.32, start: 2.002944, bitrate: 4656 kb/s Program 1 Stream #0:0[0x1e1]: Video: h264 (Main) ([27][0][0][0] / 0x001B), yuv420p(tv, bt709, progressive), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn, 59.94 tbc Stream #0:10x1e2: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 320 kb/s [ffmetadata @ 0x55990b7c3ec0] Chapter end time 1870 before start 1871 chapters_nugs_dl_tmp.txt: Cannot allocate memory

Sorrow446 commented 2 months ago

Looks like bad chapters were returned from the API. I haven't been able to fix any recent issues because I haven't got an active account to test with. PM me over Discord if you're willing to lend yours.

For now, you can disable chapters by changing this line. https://github.com/Sorrow446/Nugs-Downloader/blob/main/main.go#L1420

chapsAvail := false
Sorrow446 commented 2 months ago

I've confirmed that it's bad chapter metadata. The Nugs player ignores the bad line. It goes from "I Love Rock 'N' Roll" straight to "Crimson and Clover" missing "Nag." I'll implement code so that it ignores a line if its end time is less than its start time. Can you verify that the chapters on the Nugs player are right?

jrdean commented 2 months ago

Great detective work. Those tracks are exactly where the issue must originate.

The start time for "Nag" and "Crimson and Clover" are both listed as 31:11. 31:11 is the correct start time for Nag. Crimson and Clover actually starts at 34:01.

The web player lists the chapter start times as 31:11 Nag 31:11 Crimson and Clover 37:50 Handyman

Actual start times when I play the video are 31:11 Nag 34:01 Crimson and Clover 37:50 Handyman

Sorrow446 commented 2 months ago

Please try. https://gofile.io/d/T0f1Vi

I noticed that the artist name & container info print was removed accidentally a few commits back for videos; I'll add that back in when I push this chapter fix.

jrdean commented 2 months ago

The new main.go you linked to above worked for the video I linked to in my original post. I'll test on other videos that failed tonight and let you know how it handles those.

Will be great if you can get the Artist and container info to display again but not that big of an issue.

jrdean commented 2 months ago

https://play.nugs.net/release/17178 This is another example of a video with a bad track listing on the nugs webplayer. It failed to convert from ts to mp4 using the current main.go posted on Feb1. Two tracks both start at 54:29. The timestamps for all the tracks are messed up due to an intro track at the start of the video that the timestamps don't account for.

The good news is your your new version on gofile.io downloaded and converted it to match what's on the nugs player.

Is there a way I could input a txt file with the timestamps and tracks and have it use that for the chapters in the mp4 file?

mjg1088 commented 1 month ago

I believe I am experiencing the same issue with this file: https://play.nugs.net/release/26399

Input is: main.exe --force-video https://play.nugs.net/release/26399

Output is:

0.000 FPS, 5155 Kbps, 1080p (1920x1080) TS already exists locally, resuming from byte 3660172... 200% @ 24 MB/s, 7.3 MB/3.7 MB Putting into MP4 container... Failed to put TS into MP4 container. Item failed. exit status 0xfffffff4 [mpegts @ 0000020970fdfa40] start time for stream 2 is not set in estimate_timings_from_pts Input #0, mpegts, from 'Nugs downloads\Lotus - 04_23_21 Red Rocks Amphitheatre, Morrison, CO_1080p.ts': Duration: 00:00:06.01, start: 2488.784000, bitrate: 4875 kb/s Program 1 Stream #0:0[0x1e1]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p(progressive), 1920x1080 [SAR 1:1 DAR 16:9], 29.97 fps, 29.97 tbr, 90k tbn Stream #0:10x1ec: Audio: aac (LC) ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 320 kb/s Stream #0:2[0x1f6]: Data: timed_id3 (ID3 / 0x20334449) [ffmetadata @ 00000209737f39c0] Chapter end time 6 before start 10230 [in#1 @ 00000209737f3740] Error opening input: Cannot allocate memory Error opening input file chapters_nugs_dl_tmp.txt. Error opening input files: Cannot allocate memory

Happens with all configurations of format settings. Generates a 6 second working mp4 file.

the gofile.io link is empty. I have tried setting chapsAvail := false on line 1420 of main.go as described above and rebuilding. This has eliminated my error output, but the file generated is still only 6 seconds long. I suppose it's possible I am missing a step in this though

Sorrow446 commented 1 month ago

https://pastebin.com/raw/EbHSSMiA

mjg1088 commented 1 month ago

Thanks for uploading this! This fixed issues I was having with a few different videos, but unfortunately it still doesn't work for this one. Looking closer at the outputs, the OP's output says 1.7GB file for a 45min video, while mine says 3.7MB for a 3+hr video. Maybe I'm having a different issue?

Sorrow446 commented 1 month ago

Thanks for uploading this! This fixed issues I was having with a few different videos, but unfortunately it still doesn't work for this one. Looking closer at the outputs, the OP's output says 1.7GB file for a 45min video, while mine says 3.7MB for a 3+hr video. Maybe I'm having a different issue?

No problem. Is the FFmpeg error the same? We can talk over Discord instead if you want, it's more convenient.