AForge.NET

  :: AForge.NET Framework :: Articles :: Forums ::

Lossless H264 encoding with ffmpeg

Forum to discuss AForge.NET Framework, its features, API, how-tos, etc.

Lossless H264 encoding with ffmpeg

Postby TheSquid » Tue Feb 25, 2014 10:25 pm

Hi,
I am currently attempting to encode video files using lossless H264 encoding, using ffmpeg. I have managed to get H264 working with the help of this forum topic (by editing and rebuilding the ffmpeg c++ code): http://www.aforgenet.com/forum/viewtopi ... hilit=h264

However, I am unsure as to what settings need to be set in order to ensure lossless H264 encoding and I have not found much documentation in this area.

My current settings in the VideoFileWriter.cpp file are:
codecContex->coder_type = 1;
codecContex->flags|=CODEC_FLAG_LOOP_FILTER;
codecContex->flags2|=CODEC_FLAG2_BPYRAMID-CODEC_FLAG2_WPRED-CODEC_FLAG2_8X8DCT;
codecContex->profile=FF_PROFILE_H264_BASELINE;
codecContex->scenechange_threshold = 40;
codecContex->gop_size=40;
codecContex->max_b_frames=0;
codecContex->max_qdiff=4;
codecContex->me_method=10;
codecContex->me_range=16;
codecContex->me_cmp|= 1;
codecContex->me_subpel_quality = 5;
codecContex->qmin=0;
codecContex->qmax=0;
codecContex->qcompress=0.6f;
codecContex->keyint_min=25;
codecContex->trellis=0;
codecContex->level=13;
codecContex->refs = 16;
codecContex->weighted_p_pred = 2;
codecContex->b_frame_strategy= 1;
codecContex->color_range = libffmpeg::AVCOL_RANGE_JPEG;
codecContex->coder_type = FF_CODER_TYPE_AC;
codecContex->crf = 0;

Any insights would be greatly appreciated.

Thanks,
Jake
TheSquid
 
Posts: 1
Joined: Tue Feb 25, 2014 10:17 pm



Return to AForge.NET Framework