7

I'm trying to set the profile level of libx265 to mainstillpicture using ffmpeg. But I can't seem to do so. I'm basically trying to encode every frame as intra frame (only spatial encoding) with no temporal encoding.

I've tried the following commands

ffmpeg -f rawvideo -vcodec rawvideo -s 3840x2160 -r 30 -pix_fmt yuv420p -i <input_filename> -c:v libx265 -b:v 45000k -preset veryslow -profile:v mainstillpicture <output_filename>

and

ffmpeg -f rawvideo -vcodec rawvideo -s 3840x2160 -r 30 -pix_fmt yuv420p -i <input_filename> -c:v libx265 -b:v 45000k -preset veryslow -profile:v 3 <output_filename>
DavidPostill
  • 153,128
  • 77
  • 353
  • 394
Bubba
  • 73
  • 1
  • 1
  • 3

2 Answers2

7

While I don't know about setting the profile with ffmpeg, this is the x265 CLI code when setting the profile to main still picture :

param->maxNumReferences = 1;

/* The bitstream shall contain only one picture (we do not enforce this) */
/* just in case the user gives us more than one picture: */
param->keyframeMax = 1;
param->bOpenGOP = 0;
param->bRepeatHeaders = 1;
param->lookaheadDepth = 0;
param->bframes = 0;
param->scenecutThreshold = 0;
param->bFrameAdaptive = 0;
param->rc.cuTree = 0;
param->bEnableWeightedPred = 0;
param->bEnableWeightedBiPred = 0

So you can probably do something like this :

ffmpeg -f rawvideo -vcodec rawvideo -s 3840x2160 -r 30 -pix_fmt yuv420p -i <input_filename> -c:v libx265 -b:v 45000k -preset veryslow -x265-params keyint=1:ref=1:no-open-gop=1:weightp=0:weightb=0:cutree=0:rc-lookahead=0:bframes=0:scenecut=0:b-adapt=0:repeat-headers=1 <output_filename>
Ely
  • 2,503
  • 18
  • 16
  • Thanks that worked great. Where did you find the CLI code for the main still picture? Would be great if I could try other profiles. – Bubba Jul 06 '15 at 09:55
  • It was changed recently, you can find it here : https://bitbucket.org/multicoreware/x265/commits/86e4612d4c9c6980bede235f37bda72053cd51d5#Lsource/encoder/encoder.cppT1392 . However there aren't really "other profiles" apart from Main and Main10.. – Ely Jul 11 '15 at 13:35
0

If --total-frames is 1, then a stillpicture variant will be signaled, but this parameter is not always set by applications, particularly not when the CLI uses stdin streaming or when libx265 is used by third-party applications.

From Command Line Options — x265 documentation.

So set option -x265-params total-frames=1.