LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
LinkBack Search this Thread
Old 11-02-2012, 02:24 AM   #1
darkstarbyte
Member
 
Registered: May 2010
Location: 3 planets away from the sun.
Distribution: Linux mint, Slackware
Posts: 231

Rep: Reputation: 2
ffmpeg mpeg2 encoding bottleneck, and I can't find a work around.


I noticed on my quad core machine that ffmpeg would not use more than 50% on each core.

#First I created a ramdisk with lilo using append=" ramdisk_size=4194304"
#On fstab I added the line:
/dev/ram0 /ram tmpfs defaults 1 2

#then ran lilo
#created the /ram directory

#after the reboot with the ram disk I clocked up my cpu to its full clock of 1600Mhz per core, using cpufreq-set.

USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND
branden 3433 179 0.2 266920 15316 pts/0 Sl+ 01:12 1:15 ffmpeg -threads 8 -i dex.mpg -an -vcodec mpeg2video -threads 8 -b 15000k dex.mpeg

ffmpeg -threads 8 -i dex.mpg -an -vcodec mpeg2video -threads 8 -b 15000k dex.mpeg

frame=72058 fps=505 q=2.0 Lsize= 471050kB time=00:50:02.37 bitrate=1285.3kbits/s

Any clue why ffmpeg won't use more than 50% cpu on ram disk or hard disk, or a work around?


EDIT:
bash-4.2$ x262 --mpeg2 -B 15000 -o dex.mpeg dex.mpg
[mpeg @ 0x12032a0] max_analyze_duration 5000000 reached at 5000000
lavf [info]: 480x272p 136:135 @ 24/1 fps (vfr)
x262 [warning]: MPEG-2 + VFR is not allowed
x262 [warning]: invalid display aspect ratio
x262 [info]: using SAR=1/1
x262 [info]: using cpu capabilities: MMX2 SSE2Fast FastShuffle SSEMisalign LZCNT
x262 [info]: Main profile @ Main level
10970 frames: 258.78 fps, 533462.64 kb/s

It is slow but encodes using all of the cpu. Well it seems to affect x262 as well.

Last edited by darkstarbyte; 11-02-2012 at 02:49 AM. Reason: add x262 stuff
 
Old 11-02-2012, 09:44 PM   #2
teckk
Senior Member
 
Registered: Oct 2004
Distribution: FreeBSD Arch
Posts: 1,737

Rep: Reputation: 184Reputation: 184
Quote:
frame=72058 fps=505 q=2.0 Lsize= 471050kB time=00:50:02.37 bitrate=1285.3kbits/s
505 frames per second with a quality of 2 is blazing fast encoding with ffmpeg.
I don't know why all 4 cores aren't hitting 100%, but that's not slow.

8 threads with 4 cores, I never specify that, ffmpeg multi threads by default.
-b 15000k that's a huge video bitrate, it'll give you a huge file with no difference in video quality. I use 2500k sometimes with 1 pass encoding and that is quite big.

I've read of others speaking of this.
https://lists.ffmpeg.org/pipermail/f...ch/000079.html
http://forum.videohelp.com/threads/3...mpeg-CPU-usage
 
Old 11-03-2012, 06:17 AM   #3
darkstarbyte
Member
 
Registered: May 2010
Location: 3 planets away from the sun.
Distribution: Linux mint, Slackware
Posts: 231

Original Poster
Rep: Reputation: 2
It does not even use 15000k, I just used that so it could go faster, but that did not help.

EDIT:
Before and after the encode, because I encoded it to mpeg2 and I wanted to see why mpeg2 to mpeg2 was so slow also. On my mono-core pentium 4 clocked at 3.06Ghz I still get around 200fps.

Video Spec:
Stream #0:0(und): Video: mpeg2video, yuv420p, 480x272 [SAR 161:160 DAR 483:272], q=2-31, 15000 kb/s, 90k tbn, 24 tbc

I am building ffmpeg from scratch with custom CFLAGS, and I hope that will solve some of the issue.

Last edited by darkstarbyte; 11-03-2012 at 06:25 AM.
 
  


Reply

Tags
bottleneck, ffmpeg, mpeg


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] ffmpeg psp encoding woes (with a solution!) allstarzero Linux - Software 6 08-10-2013 03:09 PM
ffmpeg encoding mpegts adismsc Linux - Software 0 11-08-2011 04:25 AM
ffmpeg encoding script. error MystKid Linux - Newbie 6 02-27-2011 04:13 AM
ffmpeg encoding help SentralOrigin Linux - Software 5 04-23-2008 10:35 AM
ffmpeg - psp [] Need help encoding to mp4 nomb Linux - Software 7 01-08-2007 07:42 PM


All times are GMT -5. The time now is 11:04 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration