How to choose between openH264 and x264 decoder

Source: Internet
Author: User
Tags benchmark

Turn from: Https://stackoverflow.com/questions/42220081/how-to-choose-between-openh264-and-x264-decoder


Ask:down vote Favorite
The

I ' m using the dev build, zeranoe.com which has OpenH264 and libx264 in it. How can I choose between this two decoders to compare the decoding speed?

avcodec_find_decoder (avcodecid.av_codec_id_h264); 

Only gives me the name "H264" but which decoder is it?

and tries to force a specific decoder failed, like:

codec = Avcodec_find_decoder _by_name ("x264");
codec = Avcodec_find_decoder _by_name ("libx264"); 

Which Other options I have to improve the decoding speed of Avcodec_decode_video2 for highres (4k and higher) R TSP video streams?


Answer:


FFmpeg can use OpenH264 (named libopenh264 into FFmpeg) to decode in addition to the native FFmpeg H.264 decoder (named H264 ). There are also several supported hardware assisted, H.264 I ' m not decoders to go into but about going. Caveats

OpenH264 can only decode constrained Baseline profiles, so it usefulness may limited.

The native FFmpeg H.264 decoder has threading (frame and capabilities) slice but not. ffmpeg CLI Tool examples

It appears you ' re working with the FFmpeg libraries, but here are some using examples.

To choose the decoder your want use the-c:v input option. Below are two decoding benchmark using the null examples. The-map option is also used so only the (a) video stream is decoded and to ignore other, non-video streams such as AU Dio. Native FFmpeg H.264 decoder

$ ffmpeg-benchmark-i input.mp4-map 0:v:0-f null-
bench:utime=23.557s
bench:maxrss=57752kb
Real    0m3 .834s
user    0m23.573s
sys     0m0.213s
libopenh264
$ ffmpeg-benchmark-c:v libopenh264-i input.mp4-map 0:v:0-f null-
bench:utime=20.927s
bench:maxrss=37404kb< C2/>real    0m21.002s
user    0m20.940s
sys     0m0.060s
Benchmark Time

The benchmark option outputs user CPU time, not the elapsed real time. If you are want real time as OK add the time command before the FFmpeg command (if you are ' re on Linux). I added the outputs from the example (the last three lines) for comparison purposes. To verify the desired decoder is being used

View the console output. For example using the native H.264 decoder:

Stream mapping:
  stream #0:0-> #0:0 (h264 (native)-> wrapped_avframe (native))

Using libopenh264:

Stream mapping:
  stream #0:0-> #0:0 (H264 (libopenh264)-> wrapped_avframe (native))
Weird. Ffmpeg-h decoder=h264 does not show openh264 as a decoder.
0 down vote favorite 2 The

I ' m using the dev build, zeranoe.com which has OpenH264 and libx264 in it. How can I choose between this two decoders to compare the decoding speed?

avcodec_find_decoder (avcodecid.av_codec_id_h264); 

Only gives me the name "H264" but which decoder is it?

and tries to force a specific decoder failed, like:

codec = Avcodec_find_decoder _by_name ("x264");
codec = Avcodec_find_decoder _by_name ("libx264"); 

Which Other options I have to improve the decoding speed of Avcodec_decode_video2 for highres (4k and higher) R TSP video streams?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.