[FFmpeg-devel] [PATCH]Only set tff in x264 encoder for interlaced frames
Carl Eugen Hoyos
cehoyos at ag.or.at
Fri Mar 15 00:21:10 CET 2013
Hi!
FFmpeg currently (re-)sets x264's tff parameter for every frame, this breaks
lossless encoding.
Attached patch fixes lossless encoding for many progressive samples, like
ticket #2165.
Please comment, Carl Eugen
-------------- next part --------------
diff --git a/libavcodec/libx264.c b/libavcodec/libx264.c
index a394213..419b54e 100644
--- a/libavcodec/libx264.c
+++ b/libavcodec/libx264.c
@@ -175,7 +175,7 @@ static int X264_frame(AVCodecContext *ctx, AVPacket *pkt, const AVFrame *frame,
frame->pict_type == AV_PICTURE_TYPE_P ? X264_TYPE_P :
frame->pict_type == AV_PICTURE_TYPE_B ? X264_TYPE_B :
X264_TYPE_AUTO;
- if (x4->params.b_tff != frame->top_field_first) {
+ if (frame->interlaced_frame && x4->params.b_tff != frame->top_field_first) {
x4->params.b_tff = frame->top_field_first;
x264_encoder_reconfig(x4->enc, &x4->params);
}
More information about the ffmpeg-devel
mailing list