Comments (6)
Niconico is known to only have MP4 format (according to this and this Q&A pages from the niconico official site), that's why it was hard-coded to
m4a
.
Right, but those such cases are typically handled by passing mp4
as the ext
param to _extract_m3u8_formats()
, which the above patch does
from yt-dlp.
from the m4a log:
[ExtractAudio] Not converting audio 【マリオペイント】お猿のおもちゃのBGMをリミックスしてみた [nm10550338].m4a; the file is already in a common audio format
Here, the only thing that -x
is doing is implicitly selecting the bestaudio
format. yt-dlp detects that the download is already in an audio-only container (m4a) and does not extract or remux anything. So you end up with the raw product of the m3u8 playlist; the native HLS downloader just concatenates all of the AAC audio stream segments. The resulting container is not playing nice with Windows' metadata parsing.
When you pass --audio-format alac
(or any format other than m4a
or aac
), then yt-dlp will remux or re-encode the download, which effectively fixes the issue.
Possible solutions/workarounds for getting a fixed m4a container:
- use
-x -f bv+ba/b
to download the video and the audio, merge them, and then extract the audio - use
-x --parse-metadata " m4a_dash: %(container)s"
to download only audio and force remuxing after download - use ffmpeg as the downloader:
--downloader ffmpeg
- manually remux with ffmpeg after downloading, e.g.:
ffmpeg -i "input.m4a" -c copy "output.m4a"
from yt-dlp.
Those solutions worked just perfectly!
Thank you for the explanation & inputs on fixing the issue, seriously. ♥
from yt-dlp.
Looking at the extractor code though, I'm noticing we manually set the audio format extension to m4a
. I'm wondering if this should be fixed on the extractor level like this:
diff --git a/yt_dlp/extractor/niconico.py b/yt_dlp/extractor/niconico.py
index 179e7a9b1..e06740d62 100644
--- a/yt_dlp/extractor/niconico.py
+++ b/yt_dlp/extractor/niconico.py
@@ -420,7 +420,7 @@ def _yield_dms_formats(self, api_data, video_id):
'x-request-with': 'https://www.nicovideo.jp',
})['data']['contentUrl']
# Getting all audio formats results in duplicate video formats which we filter out later
- dms_fmts = self._extract_m3u8_formats(dms_m3u8_url, video_id)
+ dms_fmts = self._extract_m3u8_formats(dms_m3u8_url, video_id, 'mp4')
# m3u8 extraction does not provide audio bitrates, so extract from the API data and fix
for audio_fmt in traverse_obj(dms_fmts, lambda _, v: v['vcodec'] == 'none'):
@@ -432,7 +432,6 @@ def _yield_dms_formats(self, api_data, video_id):
'asr': ('samplingRate', {int_or_none}),
}), get_all=False),
'acodec': 'aac',
- 'ext': 'm4a',
}
# Sort before removing dupes to keep the format dicts with the lowest tbr
from yt-dlp.
Definitely shoot me a reply if/when you'd go about releasing a build including this potential patch, I'd be willing to test it out before release if for whatever reason that'd be needed as well.
Glad I was able to bring this to light & you're able to find a possible way to go about troubleshooting this!
from yt-dlp.
Niconico is known to only have MP4 format (according to this and this Q&A pages from the niconico official site), that's why it was hard-coded to m4a
.
from yt-dlp.
Related Issues (20)
- twitter blocked account for downloading videos, any improvement can be done in authentication or downloading? HOT 2
- [vimeo:user] not all videos extracted HOT 3
- sign in error ,how can i fix that, HOT 1
- yt-dlp without option -f does lead to not suited video, audio format (e.g.: avc1+ Opus), minor fault for youtube HOT 7
- Support ImageMagick for thumbnail post processing HOT 3
- Make --concat-playlist work with playlists that have mixed subtitles
- Why does yt-dlp get 403 errors but JD2 doesn't? HOT 4
- [Tiktok] friends-only video download returns HTTP Error 404 when passing proper cookies
- After packaging with PyInstaller, can the unlock plugin be used? HOT 2
- [mixch] mixch extractor does not work for videos with certain URL format HOT 4
- [youtube] NxFqohdhigY: Sign in to confirm you’re not a bot. This helps protect our community. Learn more HOT 1
- Media offline in Davinci Resolve HOT 1
- Platform Support HOT 1
- add html decode for facebook HOT 1
- add site: kidoodle.tv
- [cda.pl] Support downloading playlist (folder) HOT 1
- KissCartoon.sh HOT 1
- SOLUTION FOR THIS.... YOU CAN SOLVE THIS BY PASSING COOKIES
- --batch-file needed a blank line between each file before it worked HOT 3
- Support for Most Interesting Images on Flickr HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from yt-dlp.