Jump to content

why ffmpeg is taking so much CPU


latelx64

Recommended Posts

latelx64

I know chrome natively supports H264, so all movies in my library is h264 encoded, thus, when I streaming videos from emby@raspberrypi server to my laptop chrome, emby@raspberrypi server can directly streaming raw data to chrome, it does not need to do any video transcoding work stuff, but why process ffmpeg is takeing so much CPU resource, which make videos streaming terribly lagging?

 

pi@raspberrypi:~ $ top

 

top - 16:41:16 up 4 days,  9:44,  4 users,  load average: 10.02, 7.74, 4.12

Tasks: 261 total,   3 running, 258 sleeping,   0 stopped,   0 zombie

%Cpu(s): 60.4 us, 20.9 sy, 16.3 ni,  0.3 id,  0.0 wa,  0.0 hi,  2.1 si,  0.0 st

MiB Mem :   3906.0 total,    117.4 free,    910.6 used,   2878.0 buff/cache

MiB Swap:    100.0 total,      0.0 free,    100.0 used.   2655.4 avail Mem 

 

  PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                                             

 4891 bin       20   0  466164 264364  14352 S 273.0   6.6  21:59.30 ffmpeg                                                                                              

29924 root      20   0    7884   6172   3448 S  91.8   0.2   4:24.56 transmission-da                                                                                     

 4572 root      20   0  158964  65456   5136 S   7.6   1.6 185:00.48 python3                                                                                             

  599 www-data  20   0   51336   3820   2012 R   5.3   0.1   1:43.96 nginx     

Edited by latelx64
Link to comment
Share on other sites

rbjtech

If it's transcoding in any way (ie using ffmpeg) then the ffmpeg log will tell you - could be a container swap (streaming), or audio codec swap perhaps (AC3 to AAC for example)  - both classed as 'non transcoding' to emby but will still use and thus produce ffmpeg logs.

Link to comment
Share on other sites

latelx64

If it's transcoding in any way (ie using ffmpeg) then the ffmpeg log will tell you - could be a container swap (streaming), or audio codec swap perhaps (AC3 to AAC for example)  - both classed as 'non transcoding' to emby but will still use and thus produce ffmpeg logs.

 

where can I find the ffmpeg logs?  anyway, if it's 'non transcoding' , it should not taken so much cpu resource, right?

Link to comment
Share on other sites

rbjtech

Advanced > Logs

 

Container swaps and/or Audio codec transcoding is much less stressful on the cpu than Video encoding agreed but until we see the logs, we can't really comment further and would just be guessing.

Link to comment
Share on other sites

latelx64

please help check another problem first, when I play videos, it got frequently suspended, when the cpu load is not high, and at the same time, I can play the video through sshfs normaly.

 

5e6726c08a697_ScreenShot20200310at12330P

 

5e6726d7a3e35_ScreenShot20200310at13135P

 

here I are logs, please note, the server time is 6 hours behind my macos system time. only embyservers, no ffmpeg logs is produced

 

https://www.dropbox.com/s/czohob0e7n7yn1j/embyserver.txt?dl=0

 

(no idea how to upload files...)

Edited by latelx64
Link to comment
Share on other sites

latelx64

my device is raspberrypi 4b, using docker image emby/embyserver_arm32v7

 

here is the media info

 

Media Info

Video

Title1080p H264

CodecH264

Codec tagavc1

AVCYes

ProfileHigh

Level40

Resolution1920x1080

Aspect ratio16:9

AnamorphicNo

InterlacedNo

Framerate25

Bitrate2,091 kbps

Color primariesbt709

Color spacebt709

Color transferbt709

Bit depth8 bit

Pixel formatyuv420p

Ref frames1

NAL4

Audio

TitleEnglish AAC stereo (Default)

LanguageEnglish

CodecAAC

Codec tagmp4a

ProfileLC

Layoutstereo

Channels2 ch

Bitrate127 kbps

Sample rate44,100 Hz

DefaultYes

Containermp4

Path/mnt/documentary/中国通史/E002.第二集:中华先祖.mp4

Size716 MB

Edited by latelx64
Link to comment
Share on other sites

I don't see anything obvious in that log, but you could try our beta package and see if that performs better. We will be releasing 4.4 very soon. Thanks.

Link to comment
Share on other sites

latelx64

is there anyway to enable hardware encode acc? my device is raspberry pi 4b, with raspbian 32bit, I've already purchased the premiere. I know raspberrypi 4b nativly support h264 decoding,

but emby failed to use that.

 

https://www.dropbox.com/s/kwa7caz73mlip3z/ffmpeg-transcode-82de818f-325b-4355-9dff-e6c2b98aca27_1.txt?dl=0

 

 

this is the reason why ffmpeg is taking so much high cpu @@softworkz

Edited by Luke
Link to comment
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
×
×
  • Create New...