2014-02-25 5 views
2

현재 C에서 FFMPEG에 대한 무손실 H264 설정을 적용하려고합니다. 그러나, 나는 무손실 인코딩을 보장하기 위해 설정이 필요한지 확신 할 수 없으며이 영역에서는 거의 설명서를 찾지 못했습니다.h264 무손실 설정

나의 현재 설정은 다음과 같습니다 그들은 무손실 인코딩을 보장하는 것 무엇인지에

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; 

어떤 아이디어? 미리 감사드립니다.

답변

1

이 시도 : 난 내 C# 코드를 사용하여 액세스하는 실행 어느 때 지금, 그러나, ,

... 
AVDictionary *param; 
av_dict_set(&param, "qp", "0", 0); 
/* 
Change options to trade off compression efficiency against encoding speed. If you specify a preset, the changes it makes will be applied before all other parameters are applied. 
You should generally set this option to the slowest you can bear. 
Values available: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo. 
*/ 
av_dict_set(&param, "preset", "medium", 0); 
/* 
Tune options to further optimize them for your input content. If you specify a tuning, the changes will be applied after --preset but before all other parameters. 
If your source content matches one of the available tunings you can use this, otherwise leave unset. 
Values available: film, animation, grain, stillimage, psnr, ssim, fastdecode, zerolatency. 
*/ 
av_dict_set(&param, "tune", "film", 0); 
int rt = avcodec_open2(codecContext, codec, &param); 
... 

이 손실의 프로필을

+0

안녕 루카를 사용하지 않는 나는이 방법을 시도 DLL의이 제작 코드에서 "AccessViolationUnhandled"오류가 발생했습니다. "보호 된 메모리를 읽거나 쓰려고 시도했습니다. 이것은 종종 다른 메모리가 손상되었음을 나타냅니다." 나는이 아이디어의 원인이 무엇인지 모르겠습니다. – Squid

+0

죄송합니다. param = 0으로 설정하려고 했습니까? 왜냐하면 av_dict_set은 param = 0 일 때 메모리를 할당하지만 그렇지 않다면 메모리가 할당되었다고 생각합니다. – luca

+0

안녕 루카, 도와 줘서 고마워! 지금은 코드를 빌드하고 실행할 수 있습니다. 불행히도 파일을 디코딩하면 예상보다 작기 때문에 (일반적으로 약 25MB 정도) 순수하게 무손실로 인코딩하지는 않습니다. – Squid