Jump to content

WSL - Limit FFMPEG's (via youtube-dl) CPU Usage

Go to solution Solved by duncannah,

Are you using the --merge-output-format option to merge into mp4? Try using that if not.

 

Also, you can supply options to ffmpeg using the --postprocessor-args option: 

youtube-dl --postprocessor-args '-threads 1' ...

Replace the "1" to your liking

Hey peeps, 

 

I'm using youtube-dl to download videos, and would rather them be in MP4 instead of MKV so i can use them in iTunes. Is there any way I can limit FFMPEG's CPU usage? I have no control over the FFMPEG command that is run, and the CPU 100% is killing the rest of my system (aka Windows)

 

Thanks!

 

edit: Using Ubuntu via WSL

UTC/GMT (Except during BST)

Link to comment
Share on other sites

Link to post
Share on other sites

Wait, are you using Windows..

2 minutes ago, TheLewisS1 said:

rest of my system (aka Windows)

Or Ubuntu?

2 minutes ago, TheLewisS1 said:

edit: Using Ubuntu via WSL

 

because if I understand correctly, WSL means you're using Linux in Windows (in a virtual machine). In my mind that tells me you can just address less cores/threads to this VM and you're done.

otherwise if you're just using Windows, you can choose what threads a task can use. Just go to Task manager > Details > find the ffmpeg .exe > Right Click > Set Affinity > choose however many threads you want it to use 

"We're all in this together, might as well be friends" Tom, Toonami.

 

mini eLiXiVy: my open source 65% mechanical PCB, a build log, PCB anatomy and discussing open source licenses: https://linustechtips.com/topic/1366493-elixivy-a-65-mechanical-keyboard-build-log-pcb-anatomy-and-how-i-open-sourced-this-project/

 

mini_cardboard: a 4% keyboard build log and how keyboards workhttps://linustechtips.com/topic/1328547-mini_cardboard-a-4-keyboard-build-log-and-how-keyboards-work/

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, minibois said:

Wait, are you using Windows..

Or Ubuntu?

 

because if I understand correctly, WSL means you're using Linux in Windows (in a virtual machine). In my mind that tells me you can just address less cores/threads to this VM and you're done.

otherwise if you're just using Windows, you can choose what threads a task can use. Just go to Task manager > Details > find the ffmpeg .exe > Right Click > Set Affinity > choose however many threads you want it to use 

I'm using Ubuntu via Windows Subsystem for Linux, so It's Ubuntu in Windows. 

 

I'm going to check if the linux processes show in (windows) taskmanager now.

UTC/GMT (Except during BST)

Link to comment
Share on other sites

Link to post
Share on other sites

8 minutes ago, TheLewisS1 said:

I'm using Ubuntu via Windows Subsystem for Linux, so It's Ubuntu in Windows. 

 

I'm going to check if the linux processes show in (windows) taskmanager now.

Aha! I can see the Linux processes in Windows Task Manager, and change their affinity. Except for ffmpeg, which I don't have permission for. You were correct in else.

@minibois

 

edit: I cannot change any linux process' affinity.

UTC/GMT (Except during BST)

Link to comment
Share on other sites

Link to post
Share on other sites

you know you can get youtube-dl for windows right?

Also have you used the -F switch? it prints out all available formats, then you use -f to download a format of your choosing. I use youtube-dl to download audio only. You get a few options on most videos.

Link to comment
Share on other sites

Link to post
Share on other sites

3 minutes ago, Bacon soup said:

you know you can get youtube-dl for windows right?

Also have you used the -F switch? it prints out all available formats, then you use -f to download a format of your choosing. I use youtube-dl to download audio only. You get a few options on most videos.

I might have to try again with Windows, as I had no luck before - I couldn't get it in PATH and didn't really want to have to mess with batch script, even if I've got just as little skill in bash.

 

I used the F switch, and chose MP4, but it would only go up to 720p, so I thought/think I need(ed) to use FFMPEG to take the two different HQ formats and combine them

UTC/GMT (Except during BST)

Link to comment
Share on other sites

Link to post
Share on other sites

Are you using the --merge-output-format option to merge into mp4? Try using that if not.

 

Also, you can supply options to ffmpeg using the --postprocessor-args option: 

youtube-dl --postprocessor-args '-threads 1' ...

Replace the "1" to your liking

🙂

Link to comment
Share on other sites

Link to post
Share on other sites

1 minute ago, duncannah said:

You can supply options to ffmpeg using the --postprocessor-args option: 


youtube-dl --postprocessor-args '-threads 1' ...

Replace the "1" to your liking

That's exactly what I needed!

 

Thank you very much!

UTC/GMT (Except during BST)

Link to comment
Share on other sites

Link to post
Share on other sites

On 11/3/2019 at 4:47 PM, TheLewisS1 said:

I'm using Ubuntu via Windows Subsystem for Linux, so It's Ubuntu in Windows. 

 

I'm going to check if the linux processes show in (windows) taskmanager now.

Don't think it's virtual machine. It seems to have access to your windows system and files while real vm doesn't and shouldn't.

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

  • 3 weeks later...
On 11/7/2019 at 1:39 PM, wasab said:

Don't think it's virtual machine. It seems to have access to your windows system and files while real vm doesn't and shouldn't.

yep its not a Vm, rather a shim. the biggest issue i have found with WSL is IO performance. basically windows is mapping its own apis to linux apis and doing so is slow in some cases were these things dont line up. (like disk and network). You can think of it a bit like WINE but in reverse. 

Link to comment
Share on other sites

Link to post
Share on other sites

1 hour ago, hishnash said:

yep its not a Vm, rather a shim. the biggest issue i have found with WSL is IO performance. basically windows is mapping its own apis to linux apis and doing so is slow in some cases were these things dont line up. (like disk and network). You can think of it a bit like WINE but in reverse. 

it is windows version of WINE. It pretty much just translates api calls, underlying operating system calls and codes are all natives. 

Sudo make me a sandwich 

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×