FAQ  •  Register  •  Login

ffmpeg, kill, cpu, again

<<

tcriss

Serviio newbie

Posts: 3

Joined: Tue Nov 28, 2017 2:43 am

Post Tue Nov 28, 2017 2:54 am

ffmpeg, kill, cpu, again

Hi,

Sorry to ask the same question I saw being asked a number of times on these forums.
I could not find a real answer to it.

I understand that somehow, it is 'by design' to avoid stopping ffmpeg even if the user stops playing the video.

1. What is the purpose of keeping ffmpeg running? Why is it 'by design' like this?

Please don't just say 'is by design', that doesn't help. If there is an explanation in some other place, just send me the link please.

2. Is there a way of doing it automatically when the video stops? (no, don't say killall ffmeg, it not automatic and I am in front of my tv, not ssh-ing into my server, come on)

3. why is it that ffmpeg takes up the whole cpu power? 1 core or 10, seems that it always uses 100% available cores/threads.
Is there a way to 'nice' the use of ffmpeg in serviio? To avoid using the whole cpu?


Thanks,
Chris
<<

lagunaa

Serviio lover

Posts: 60

Joined: Thu Jan 07, 2016 1:57 pm

Post Tue Nov 28, 2017 10:46 am

Re: ffmpeg, kill, cpu, again

tcriss wrote:I understand that somehow, it is 'by design' to avoid stopping ffmpeg even if the user stops playing the video.

According to ticket #427:
Stop server now stops all FFmpeg processes and cleans the temp folder

so it should be fixed if you're on version 1.6.1 or above.
Cheers.
<<

atc98092

User avatar

DLNA master

Posts: 5213

Joined: Fri Aug 17, 2012 10:22 pm

Location: Washington (the state)

Post Tue Nov 28, 2017 11:38 am

Re: ffmpeg, kill, cpu, again

The main issue is that the DLNA protocol does not have anything that tells the server that the device has stopped playback, other than requesting a new video to begin playing to the same device. There's nothing to tell Serviio that playback has stopped. So unless you request a new video (that doesn't require any transcoding), there's nothing to stop ffmpeg until it reaches the end of the video.
Dan

LG NANO85 4K TV, Samsung JU7100 4K TV, Sony BDP-S3500, Sharp 4K Roku TV, Insignia Roku TV, Roku Ultra, Premiere and Stick, Nvidia Shield, Yamaha RX-V583 AVR.
Primary server: Intel i5-6400, 16 gig ram, Windows 10 Pro, 22 TB hard drive space | Test server Windows 10 Pro, AMD Phenom II X4 965, 8 gig ram

HOWTO: Enable debug logging HOWTO: Identify media file contents
<<

tcriss

Serviio newbie

Posts: 3

Joined: Tue Nov 28, 2017 2:43 am

Post Tue Nov 28, 2017 12:48 pm

Re: ffmpeg, kill, cpu, again

HI, thanks for the answers

stopping the server is not what I want, I want to avoid using ffmpeg when playing the video stops, without any other user intervention (to me this sounds perfectly reasonable)

I understand now that the DLNA protocol does not signal in any way that video playing was stopped.
Anyway, isn't there a way to detect, via polling the network maybe, if streaming continues or not?

thanks
Chris
<<

atc98092

User avatar

DLNA master

Posts: 5213

Joined: Fri Aug 17, 2012 10:22 pm

Location: Washington (the state)

Post Tue Nov 28, 2017 2:07 pm

Re: ffmpeg, kill, cpu, again

That's a question for Zip to answer, but my guess is that it isn't worth the effort. Most computers can handle ffmpeg running in the background, regardless of the CPU load. I know I can still use my computer, even when ffmpeg is showing almost 100% CPU usage. But that certainly varies based on the computer hardware.
Dan

LG NANO85 4K TV, Samsung JU7100 4K TV, Sony BDP-S3500, Sharp 4K Roku TV, Insignia Roku TV, Roku Ultra, Premiere and Stick, Nvidia Shield, Yamaha RX-V583 AVR.
Primary server: Intel i5-6400, 16 gig ram, Windows 10 Pro, 22 TB hard drive space | Test server Windows 10 Pro, AMD Phenom II X4 965, 8 gig ram

HOWTO: Enable debug logging HOWTO: Identify media file contents
<<

zip

User avatar

Serviio developer / Site Admin

Posts: 17212

Joined: Sat Oct 24, 2009 12:24 pm

Location: London, UK

Post Tue Nov 28, 2017 2:21 pm

Re: ffmpeg, kill, cpu, again

Yeah, imagine pausing the video while you have a phone call, coming back 20 minutes later and having to play from the beginning. Any other workaround is not 100%, so it's cause more troubles than it solves.

For ffmpeg usage, you can limit number of cores to use - for some encoders anyway - which might limit the usage. But usually, when you want smooth playback it's best to have FFmpeg finish ASAP.
<<

tcriss

Serviio newbie

Posts: 3

Joined: Tue Nov 28, 2017 2:43 am

Post Tue Nov 28, 2017 7:30 pm

Re: ffmpeg, kill, cpu, again

Ok,
the only thing that makes sense is that is non-trivial to implement (if DLNA does not signal stopping the player).
Otherwise, using the cpu is just a waste of resources. Is useless since watching has stopped.

*if* you start watching again, then yes, start transcoding again.
No need to 'optimize' this by leaving ffmeg running 'just in case' you want to resume something.

what if I stop watching a full movie after 2 minutes and come back later, after two hours? and all this in a low power home server (which has enough power for transcoding, but no need to waste it)?

Transcoding process should be 'owned' by the dlna server (it is started by the server and stopped by the server).
It's plain simple and reasonable.

I have no idea if other dlna servers allow this, but it would make perfect sense.
Thanks
<<

atc98092

User avatar

DLNA master

Posts: 5213

Joined: Fri Aug 17, 2012 10:22 pm

Location: Washington (the state)

Post Tue Nov 28, 2017 10:11 pm

Re: ffmpeg, kill, cpu, again

tcriss wrote:
what if I stop watching a full movie after 2 minutes and come back later, after two hours? and all this in a low power home server (which has enough power for transcoding, but no need to waste it)?


If that particular player has not requested a different movie, then it will play the file that have already been transcoded, without needing to be done again. The transcoded file is not deleted until that particular player asks for a different video.
Dan

LG NANO85 4K TV, Samsung JU7100 4K TV, Sony BDP-S3500, Sharp 4K Roku TV, Insignia Roku TV, Roku Ultra, Premiere and Stick, Nvidia Shield, Yamaha RX-V583 AVR.
Primary server: Intel i5-6400, 16 gig ram, Windows 10 Pro, 22 TB hard drive space | Test server Windows 10 Pro, AMD Phenom II X4 965, 8 gig ram

HOWTO: Enable debug logging HOWTO: Identify media file contents

Return to Serviio Support & Help

Who is online

Users browsing this forum: No registered users and 59 guests

cron
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by ST Software for PTF.