This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Optimal H264 HP encoder parameters

Hello,

I am testing the h264 hp encoder with a sports-action clip and a water-action clip. I am using the TSU component of MCSDK_VIDEO to downscale an original 1080p source then encoding it. I am downscaling to 720p and 480p and encoding at 2 Mbps bitrate and 1 Mbps bitrate, respectively. The quality is not very good compared to what I get from using ffmpeg. I've attached the parameters that I am currently using. I use the same parameters for all 4 encodes except for target bitrate and input/capture width/height. What would be the optimal parameters to use for these test cases?

Chris
Signalogic

2541.params.txt

  • Hi Chris,

    For sports action kind of sequences,
    please try attached settings and select that is suitable to you.
    We cannot directly compare ffmpeg(PC encoding) and C6678 encoding(Real time encoding). Realtime encoding will have resource/power/speed/quality constraints. You will have to make sure number of reference frames, search ranges, single pass etc in common.
    Regards
    Sudheesh
  • Sudheesh,

    Thanks for the suggested parameters, but even with these I don't get quality comparable to ffmpeg.

    Right now, I am only concerned with quality at these specific resolutions/bitrates and not any of the constraints that would apply to a realtime encoding situation. Is it possible to configure the encoder to get quality comparable to ffmpeg or is the codec limited in that regard?

    ---You will have to make sure number of reference frames, search ranges, single pass etc in common.
    I don't see settings for these in the parameters. Which parameters correspond to some of these settings?

    Chris

  • Hi Chris, could you please share with us used ffmpeg version (build) and parameters?. Could you also please share with us (if possible) a sample of the clips that you are using (before and after scaling).

    Thanks for your help,

    Paula

  • Paula,

    I am using ffmpeg version 0.11.2. This is the command I am using:

    ffmpeg -f raw_video -pix_fmt yuv420p -s:v 1920x1080 -r 30 -i touchdown_pass_1080p.yuv -strict experimental -vf drawbox=0:0:2000:6:black,drawbox=0:6:2000:4:black -c:v libx264 -g 120 -sc_threshold 0 -flags +cgop -b:v 1024000 -s:v 850x480 -r:v 30000/1001 -preset:v superfast -profile:v main -threads auto -vol 768 -c:a aac -b:a 128k -r:a 48k -ac 2 -f flv touchdown_pass_480p_ffmpeg.h264 -strict experimental -vf drawbox=0:0:2000:6:black,drawbox=0:6:2000:4:black -c:v libx264 -g 120 -sc_threshold 0 -flags +cgop -b:v 2048000 -s:v 1280x720 -r:v 30000/1001 -preset:v superfast -profile:v main -threads auto -vol 768 -c:a aac -b:a 128k -r:a 48k -ac 2 -f flv touchdown_pass_720p_ffmpeg.h264

    I'll have to figure out the best way to send the clips since they're so large. The originals were downloaded from here:
    http://media.xiph.org/video/derf/

    These are the originals of the two clips we are using:
    http://media.xiph.org/video/derf/y4m/touchdown_pass_1080p.y4m
    http://media.xiph.org/video/derf/y4m/ducks_take_off_1080p50.y4m

    Thanks,
    Chris

  • Paula,

    I am emailing our ftp info to download the original files along with the encoded videos. The scaled down videos are not uploaded to the site right now, but we don't see any quality issues with scaling.

    Chris

  • Hi Chris,

    1) H264HP encoder supports max 2 reference frame(forward & Backward). This can be controlled using interframeinterval & intra frame interval.

    2) It supports only single pass encoding & fixed search range due to memory limitations. 

    We are checking streams shared by you and get best possible configuration. Will update you on Monday.

    Regards

    Sudheesh

  • Thanks for the info and update Sudheesh.

  • Hi Chris,

    We have found some differences ffmpeg and C66x H264 HP in encoding tools/methods which can have significant impact on quality. We compared ffmpeg h264 file(generated with v1.0.1 and config provided by you) with C66x file shared by you.

    ffmpeg uses maximum of 4 reference frames.
    ffmpeg uses weighted prediction which is not supported in C6678 H264HP.
    ffmpeg uses adaptive gop and so when there are lot of motion observed in scenes it is coded mainly with P frames only. This is not supported in C6678 H264HP.

    We will further analyse and will give you more inputs/suggestions.

    Regards

    Sudheesh

  • Sudheesh,

    Out of the differences you have mentioned between the TI encoder and ffmpeg (single pass only, 2 reference frame limit, no weighted prediction, and no adaptive gop), what would be their relative weights in how much of an effect they would have on quality of action sequences?

    Thanks,
    Chris

  • Sudheesh-

    Or to ask another way, if we were to modify TI video codec source for improved quality in action/motion sequences, which area would you recommend working on first?  Adaptive GOP?

    -Jeff

  • Hi Jeff,

    Bit allocation for high motion areas is better for adaptive GOP configuration compared to fixed GOP. Tuning rate control algorithm based on that may improve further. 

    Thanks and regards

    Sudheesh