LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   recording from youtube.com with youtube-dl, ffmpeg fails to merge (https://www.linuxquestions.org/questions/linux-general-1/recording-from-youtube-com-with-youtube-dl-ffmpeg-fails-to-merge-4175688648/)

Skaperen 01-15-2021 07:15 PM

recording from youtube.com with youtube-dl, ffmpeg fails to merge
 
i am working on a separate, totally different, project involving youtube-dl and ffmpeg. i get only separate video (mp4) and audio (webm) files and an empty that i suspect is the intended merge.

i am trying to download my brother's wedding video at https://www.youtube.com/watch?v=yakmwIqa8cs

i get the follow error messages:

Code:


[download] 100% of 45.58MiB in 01:05
[ffmpeg] Merging formats into "Howard Wedding-yakmwIqa8cs.mp4"
[debug] ffmpeg command line: ffmpeg -y -loglevel repeat+info -i 'file:Howard Wedding-yakmwIqa8cs.f137.mp4' -i 'file:Howard Wedding-yakmwIqa8cs.f251.webm' -c copy -map 0:v:0 -map 1:a:0 'file:Howard Wedding-yakmwIqa8cs.temp.mp4'
ERROR:  Stream #1:0 -> #0:1 (copy)
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/youtube_dl/YoutubeDL.py", line 2075, in post_process
    files_to_delete, info = pp.run(info)
  File "/usr/local/lib/python3.6/dist-packages/youtube_dl/postprocessor/ffmpeg.py", line 523, in run
    self.run_ffmpeg_multiple_files(info['__files_to_merge'], temp_filename, args)
  File "/usr/local/lib/python3.6/dist-packages/youtube_dl/postprocessor/ffmpeg.py", line 235, in run_ffmpeg_multiple_files
    raise FFmpegPostProcessorError(msg)
youtube_dl.postprocessor.ffmpeg.FFmpegPostProcessorError:  Stream #1:0 -> #0:1 (copy)

i've also tried merging into mkv with a similar failure. does anyone know what is going on with youtube-dl and ffmpeg? i have gotten merge files from several weeks ago and an attempt back in 2017, but they all have no audio. play this in a browser works fine (i hear audio). playing the webm file plays audio only. thus, i suspect youtube-dl doesn't know how to record all youtube.com videos. how is this one different if it can record other videos?

and, no, i am not in it. so don't bother trying to guess who i am.

ondoho 01-16-2021 04:05 AM

Full command line, full output please.

lvm_ 01-16-2021 05:44 AM

1. update youtube-dl to the latest version (sudo youtube-dl -U), also make sure that ffmpeg and python are updated
2. run youtube-dl with -k to keep downloaded files and then run ffmpeg manually as specified at '[debug] ffmpeg command line:' to diagnose the issue further

I was able to download and merge your video into mkv using ffmpeg post-processing without issues, so the problem is with your setup, not with youtube-dl.

Skaperen 01-16-2021 11:52 AM

it must be something in my local script that runs youtube-dl then. i always wrap major things with a script so that things like arguments and option are consistent and deliberate. that i don't forget something the next i run the command. running my script looks like this:
Code:

ytdl https://www.youtube.com/watch?v=yakmwIqa8cs
what will be relevant is how the script then runs youtube-dl. it forms the command it is about to do in a list and calls print to display it just before it executes it. i can optionally enable a differ wedge script by setting execute permission on it. it is in ~/cmd which is in the PATH list ahead of /usr/bin. so, i need to get a full output as ondoho requested. i'll need to run it, again, as the virtual work space i previously run it on has been scrolled with other stuff. will post again with that.

Skaperen 01-16-2021 01:03 PM

i stumbled onto the problem. it's in mplayer. the merged video did have audio. if the previous video it played was muted when it quit, that mute setting, wherever it was set (maybe in pulseaudio?), was still in effect on the next video it played, even though mplayer's own state for mute was disabled. pressing "m" twice (enabled then disabled) fixes it. but ffplay works correctly. my guess is that mplayer needs to either silence itself if it set mute on pulseaudio or initialize things more appropriately.

i am not going to follow up on mplayer, though i should be sure i have the latest version i may learn to use ffplay.

Skaperen 01-16-2021 01:48 PM

i think i am getting different projects mixed up in my head. i need to focus on one for a while. the wedding project was having a different issue that i am now unable to reproduce even though i has happened a few times before. maybe i need to rewrite these scripts. youtube-dl seems to be working OK, now.

rnturn 01-17-2021 02:42 AM

Quote:

Originally Posted by Skaperen (Post 6208457)
youtube-dl seems to be working OK, now.

That utility is updated so often that my weekly zypper checks for update aren't sufficient. I wound up writing a small script to update just youtube-dl via cron. I don't use it all that often but until I started looking for updates daily, it seemed it was always out of date. I feel for the maintainer.

teckk 01-17-2021 08:17 AM

Quote:

it seemed it was always out of date. I feel for the maintainer.
I do too. That's because utube changes all the time, on purpose. They change a keyword just a little in the source so that you have to change the script to parse the json. They also deliver different source for different user_agents. They have to respond to a recent googlebot user agent though. Otherwise they could not index it.

Skaperen 01-17-2021 02:33 PM

so, i should upgrade youtube-dl whenever something fails, and try again.

boughtonp 01-17-2021 04:42 PM

Quote:

Originally Posted by Skaperen (Post 6208874)
so, i should upgrade youtube-dl whenever something fails, and try again.

That's what I do.

Unlike others, I find it can vary anywhere from 3 weeks to 3 months between upgrades - my guess is it depends on the videos involved.


ondoho 01-18-2021 12:58 AM

Quote:

Originally Posted by boughtonp (Post 6208902)
Unlike others, I find it can vary anywhere from 3 weeks to 3 months between upgrades - my guess is it depends on the videos involved.

For youtube-dl?
At least for youtube itself, updates come in about weekly, sometimes more often, if there is a need. (There was a lull during the RIAA desaster, though.) Other sites can take much longer.
I hope you're not relying on your distro's packaged youtube-dl. No, you must use the version straight from their site, or from github, and be able to pull in updates yourself. youtube-dl even has a "-U" option for that.

lvm_ 01-18-2021 02:29 AM

Quote:

Originally Posted by ondoho (Post 6209007)
At least for youtube itself, updates come in about weekly, sometimes more often, if there is a need.

Any software in active development is updated fairly frequently but it doesn't mean there is a *need* for that. I use youtube-dl fairly often and mostly for youtube but update it only when something stops working, and that happens nowhere near to what you are saying - couple of times a year or so.

boughtonp 01-18-2021 07:42 AM

Quote:

Originally Posted by ondoho (Post 6209007)
For youtube-dl?
At least for youtube itself, updates come in about weekly, sometimes more often, if there is a need.

Yes, youtube-dl from their site, downloading from YouTube. I'm not saying there aren't changes - the release notes show how often the youtube extractor is updated - but my use of youtube-dl apparently does not encounter breaking issues as frequently as others appear to.


Skaperen 01-18-2021 05:33 PM

i suppose youtube-dl updates could be from just one site in the huge list needing a scraper update. so each update might fix what just a fraction of users need to be fixed. to the extent that updates are expensive, just update when needed. how do you know when that is? :-)

ondoho 01-19-2021 12:40 PM

Quote:

Originally Posted by lvm_ (Post 6209038)
Any software in active development is updated fairly frequently but it doesn't mean there is a *need* for that. I use youtube-dl fairly often and mostly for youtube but update it only when something stops working, and that happens nowhere near to what you are saying - couple of times a year or so.

That is not my experience at all, at least for youtube.com itself.
The ability to download videos breaks every now and then (*), because effing googlevideo changed the site layout again, with that specific purpose. The problem is that it rarely breaks completely, only for certain videos, certain countries, only for playlists etc.etc.
youtube-dl is keeping abreast by updating its code all the time. This is not comparable to updates in other software development in general.
You can update often, pre-emptively so to speak, or only after you hit a snag - the outcome is the same in the end.

(*) I can't say exactly because I do update pre-emptively, but even so it happens every couple'o months or so, that I cannot download, update youtube-dl, then can download.


All times are GMT -5. The time now is 02:44 PM.