muhamed-didovic / vsdown

vueschool-downloader
MIT License
14 stars 2 forks source link

Merge m4a and mp4 into one single file vidoe file? #12

Open KoichaDev opened 7 months ago

KoichaDev commented 7 months ago

I noticed that I'm downloading separated file that is .m4a and .mp4.

Is there any reason the audio and video are not synched together into one file, which will be only .mp4?

muhamed-didovic commented 7 months ago

@KoichaDev yt-dlp is handling everything merging and etc, check in folder what you get in the end

KoichaDev commented 7 months ago

@KoichaDev yt-dlp is handling everything merging and etc, check in folder what you get in the end

I did remove the dependency ytdl-run but kept the yt-dlp-wrap. The reason is that If I try to run npm install with the ytdl-run, then I get this error log below:

npm ERR! code 1
npm ERR! path /Users/khoi/Developments/vsdown/node_modules/ytdl-run
npm ERR! command failed
npm ERR! command sh -c node ./install.js
npm ERR! installing youtube-dl...
npm ERR! (node:37639) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! /Users/khoi/Developments/vsdown/node_modules/got/index.js:482
npm ERR!                        proxy.emit('error', new got.HTTPError(statusCode, res.statusMessage, res.headers, opts), null, res);
npm ERR!                                            ^
npm ERR! 
npm ERR! GotError [HTTPError]: Response code 451 (Unavailable For Legal Reasons)
npm ERR!     at EventEmitter.<anonymous> (/Users/khoi/Developments/vsdown/node_modules/got/index.js:482:24)
npm ERR!     at EventEmitter.emit (node:events:519:28)
npm ERR!     at getResponse (/Users/khoi/Developments/vsdown/node_modules/got/index.js:320:5)
npm ERR!     at Immediate.<anonymous> (/Users/khoi/Developments/vsdown/node_modules/got/index.js:147:6)
npm ERR!     at process.processImmediate (node:internal/timers:478:21) {
npm ERR!   host: 'yt-dl.org',
npm ERR!   hostname: 'yt-dl.org',
npm ERR!   method: 'GET',
npm ERR!   path: '/downloads/latest/youtube-dl',
npm ERR!   protocol: 'https:',
npm ERR!   url: 'https://yt-dl.org/downloads/latest/youtube-dl',
npm ERR!   statusCode: 451,
npm ERR!   statusMessage: 'Unavailable For Legal Reasons',
npm ERR!   headers: {
npm ERR!     date: 'Mon, 25 Mar 2024 11:25:26 GMT',
npm ERR!     'content-type': 'text/html; charset=UTF-8',
npm ERR!     'content-length': '384',
npm ERR!     connection: 'keep-alive',
npm ERR!     server: 'nginx',
npm ERR!     'last-modified': 'Tue, 01 Aug 2023 08:39:22 GMT',
npm ERR!     etag: '"180-601d87bdde71b"',
npm ERR!     'accept-ranges': 'bytes',
npm ERR!     'x-xss-protection': '1; mode=block',
npm ERR!     'x-frame-options': 'SAMEORIGIN',
npm ERR!     'strict-transport-security': 'max-age=31536000',
npm ERR!     'x-content-type-options': 'nosniff',
npm ERR!     'referrer-policy': 'strict-origin-when-cross-origin'
npm ERR!   }
npm ERR! }
npm ERR! 
npm ERR! Node.js v21.7.1

The output I get from this course

SCR-20240325-ldrh

As you can see, it's a separated file .m4a and .mp4. There is no sound on .mp4, only in .m4a. I assume the .m4a are supposed to merge in with .mp4 when downloading the videos.

Any idea why this is happening?

TheChatty commented 7 months ago

I noticed that split audio/video files are happening not in all but (reproducable) in the following courses:

28-Vue 3 Composition API
50-Nuxt.js 3 Fundamentals
51-Build a Drag-and-Drop Trello Board with Vue.js
52-Rapid Testing with Vitest
54-Robust Vue.js Forms with FormKit
55-Laravel Backends for Vue.js 3
57-Common Vue.js Mistakes and How to Avoid Them
58-Charts for Vue.js 3
59-AI Chat Bot with Vue.js and GPT-4
60-Advanced Components Exposing Internal State
61-Vue.js Transitions and Animations
63-Content Sites with Astro and Vue.js
64-Material UI with Vuetify and Vue.js
65-Tailwind CSS Fundamentals
66-A "Wordle" on Test Driven Development in Vue.js
69-Nuxt Modules The Ultimate Guide

You can merge them with ffmpeg -i audio.m4a -i video.mp4 -c copy output.mp4.

Additional info @muhamed-didovic: Split audio/video files still carry the ".fdash-fastly_skyfire_sep-[audio|video]-abcdefgh" signature in the filename with different hash values for the same video.

muhamed-didovic commented 7 months ago

hey guys, sorry for delay, try to update yt-dlp to last version on your system, also run the downloader with debug prefix so if any error pops up let me know

TheChatty commented 7 months ago

Using node v21.7.1 and yt-dlp 2024.03.10 I still have all seperate audio/video files for course 57-Common Vue.js Mistakes and How to Avoid Them (a free course for you to try).

muhamed-didovic commented 7 months ago

ok, try to delete that folder and try to download it again, if it happens again let me know. I downloaded entire site over the last free weekend without any issues

TheChatty commented 1 week ago

Could you please update your dependencies (lots of deprecated libs, ytdl-run uses a non-working link for yt-dlp and so on)?

Nevertheless, calling yt-dlp manually I found the error message that it needs ffmpeg for merging. Thus I dropped ffmpeg.exe in the vsdown root folder and videos are finally merged.

muhamed-didovic commented 1 week ago

I pushed new version, please check and run and let me know...