Opened 10 years ago

Closed 5 years ago

Last modified 4 years ago

#11212 closed enhancement (no change required)

Video encoding is single-threaded

Reported by: kallisti5 Owned by: nobody
Priority: normal Milestone:
Component: Kits/Media Kit Version: R1/Development
Keywords: Cc:
Blocked By: Blocking:
Platform: All

Description

Converting a video with MediaConverter results in a single thread being consumed. As FFMPEG supports multiple threads for encoding, this should be investigated. (or an option added to MediaConverter to specify threads)

Attachments (1)

0001-Set-thread_count-configuration-variable-to-actual-nu.patch (979 bytes ) - added by Barrett 9 years ago.

Download all attachments as: .zip

Change History (16)

comment:1 by pulkomandy, 10 years ago

Does the ancinet version of ffmpeg we use support multiple threads, or is that a more recent addition to ffmpeg?

comment:2 by korli, 10 years ago

For decoding it's done here. Now it's up to the encoder/decoder to actually use this setting.

comment:3 by Barrett, 9 years ago

Isn't system_info.info.cpu_count set to the number of cpu cores? If i'm right, it's actually the expected way to work, and there's not any advantage on raw calculus to increase or decrease the number of threads behind.

comment:4 by pulkomandy, 9 years ago

That code is only for decoding, we need to do the same for encoding (in AVCodecEncoder). As mentionned this also assumes ffmpeg will actually use the setting (it may not do so with some video formats).

comment:5 by Barrett, 9 years ago

patch: 01

comment:6 by Barrett, 9 years ago

I was referring mostly to add it as a configurable option in MediaConverter. In the patch attached i've add the setting in the fContext of AVCodecEncoder and it adds two threads with my dual core cpu compared to the same rev built without it. The cores are more balanced, it can be seen in ProcessController where without the patch there's just one core in high load.

Last edited 9 years ago by Barrett (previous) (diff)

comment:7 by Barrett, 9 years ago

There's anyway an accuracy drop when the patch is applied, it may be related to the comments contained in AVFormatReader.cpp. Our version of ffmpeg is also compiled without the --enable-pthread flag which may be cause of problems.

comment:8 by pulkomandy, 8 years ago

What do you mean by "accuracy drop"? Is the encoding less good?

Another option could be to process several files at a time at MediaConverter side. This would be more generic and work also with other encoders, but help with MediaConverter only, and not with other apps.

comment:9 by Barrett, 8 years ago

The resulting files played correctly in MediaPlayer but the image was visibly distorted with things like frames dropped. I think the result was different depending on the format, but it has passed a few time since i've tested it.

comment:10 by axeld, 7 years ago

Owner: changed from axeld to nobody
Status: newassigned

comment:11 by pulkomandy, 6 years ago

Patch migrated to Gerrit: https://review.haiku-os.org/58

comment:12 by pulkomandy, 6 years ago

patch: 10

comment:13 by waddlesplash, 6 years ago

Related: #11657.

comment:14 by waddlesplash, 5 years ago

Resolution: no change required
Status: assignedclosed

Patch was abandoned as it is not needed, FFmpeg does this already.

comment:15 by nielx, 4 years ago

Milestone: Unscheduled

Remove milestone for tickets with status = closed and resolution != fixed

Note: See TracTickets for help on using tickets.