Skip to content
Snippets Groups Projects
Commit 96587199 authored by Damian Minkov's avatar Damian Minkov
Browse files

Adds option to change h264 encoder presets.

parent 59b4e07d
No related branches found
No related tags found
No related merge requests found
......@@ -63,6 +63,36 @@ public class JNIEncoder
= "net.java.sip.communicator.impl.neomedia.codec.video.h264."
+ "defaultProfile";
/**
* A preset is a collection of options that will provide a certain encoding
* speed to compression ratio. A slower preset will provide
* better compression (compression is quality per size).
*/
public static final String PRESET_PNAME
= "org.jitsi.impl.neomedia.codec.video.h264.preset";
/**
* The available presets we can use with the encoder.
*/
public static final String[] AVAILABLE_PRESETS =
{
"ultrafast",
"superfast",
"veryfast",
"faster",
"fast",
"medium",
"slow",
"slower",
"veryslow"
};
/**
* The default value of the {@link #PRESET_PNAME}
* <tt>ConfigurationService</tt> property.
*/
public static final String DEFAULT_PRESET = AVAILABLE_PRESETS[0];
/**
* Key frame every 150 frames.
*/
......@@ -489,6 +519,11 @@ else if("h264.profile".equals(k))
logger.warn("The FFmpeg JNI library is out-of-date.");
}
String preset
= (cfg == null)
? null
: cfg.getString(PRESET_PNAME, DEFAULT_PRESET);
if (FFmpeg.avcodec_open2(
avctx,
avcodec,
......@@ -503,7 +538,7 @@ else if("h264.profile".equals(k))
//"crf" /* constant quality mode, constant ratefactor */, "0",
"intra-refresh", "1",
"partitions", "b8x8,i4x4,p8x8",
"preset", "ultrafast",
"preset", preset,
"thread_type", "slice",
"tune", "zerolatency")
< 0)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment