int copy_initial_nonkeyframes;
enum PixelFormat pix_fmts[2];
+ int keep_pix_fmt;
} OutputStream;
static char *choose_pixel_fmts(OutputStream *ost)
{
+ if (ost->keep_pix_fmt) {
+ if (ost->filter)
+ avfilter_graph_set_auto_convert(ost->filter->graph->graph,
+ AVFILTER_AUTO_CONVERT_NONE);
+ if (ost->st->codec->pix_fmt == PIX_FMT_NONE)
+ return NULL;
+ ost->pix_fmts[0] = ost->st->codec->pix_fmt;
+ return ost->pix_fmts;
+ }
if (ost->st->codec->pix_fmt != PIX_FMT_NONE) {
return av_strdup(av_get_pix_fmt_name(choose_pixel_fmt(ost->st, ost->enc, ost->st->codec->pix_fmt)));
} else if (ost->enc->pix_fmts) {
return ret;
}
+ if (ost->keep_pix_fmt)
+ avfilter_graph_set_auto_convert(fg->graph,
+ AVFILTER_AUTO_CONVERT_NONE);
+
if ((ret = avfilter_graph_config(fg->graph, NULL)) < 0)
return ret;
uint8_t *buftmp;
int64_t size_out;
- int frame_bytes, resample_changed, ret;
+ int frame_bytes, resample_changed;
AVCodecContext *enc = ost->st->codec;
AVCodecContext *dec = ist->st->codec;
int osize = av_get_bytes_per_sample(enc->sample_fmt);
int planes = av_sample_fmt_is_planar(dec->sample_fmt) ? dec->channels : 1;
int i;
int out_linesize = 0;
- int buf_linesize = decoded_frame->linesize[0];
av_assert0(planes <= AV_NUM_DATA_POINTERS);
buf[i] = t;
}
size += byte_delta;
- buf_linesize = allocated_async_buf_size;
av_log(NULL, AV_LOG_VERBOSE, "adding %d audio samples of silence\n", idelta);
}
} else if (audio_sync_method > 1) {
buftmp = audio_buf;
size_out = swr_convert(ost->swr, ( uint8_t*[]){buftmp},
allocated_audio_buf_size / (enc->channels * osize),
- buf,
+ (const uint8_t **)buf,
size / (dec->channels * isize));
if (size_out < 0) {
av_log(NULL, AV_LOG_FATAL, "swr_convert failed\n");
if (delta <= -0.6)
nb_frames = 0;
else if (delta > 0.6)
- ost->sync_opts = lrintf(sync_ipts);
+ ost->sync_opts = lrint(sync_ipts);
break;
case VSYNC_DROP:
case VSYNC_PASSTHROUGH:
- ost->sync_opts = lrintf(sync_ipts);
+ ost->sync_opts = lrint(sync_ipts);
break;
default:
av_assert0(0);
AVFrame *filtered_frame = NULL;
int i, ret, ret_all;
unsigned nb_success, nb_eof;
+ int64_t frame_pts;
while (1) {
/* Reap all buffers present in the buffer sinks */
}
break;
}
- filtered_frame->pts = av_rescale_q(picref->pts, ist_pts_tb, AV_TIME_BASE_Q);
+ filtered_frame->pts = frame_pts = av_rescale_q(picref->pts, ist_pts_tb, AV_TIME_BASE_Q);
//if (ost->source_index >= 0)
// *filtered_frame= *input_streams[ost->source_index]->decoded_frame; //for me_threshold
switch (ost->filter->filter->inputs[0]->type) {
case AVMEDIA_TYPE_VIDEO:
avfilter_fill_frame_from_video_buffer_ref(filtered_frame, picref);
+ filtered_frame->pts = frame_pts;
if (!ost->frame_aspect_ratio)
ost->st->codec->sample_aspect_ratio = picref->video->sample_aspect_ratio;
return AVERROR(EINVAL);
}
- ist->dr1 = codec->capabilities & CODEC_CAP_DR1;
+ ist->dr1 = (codec->capabilities & CODEC_CAP_DR1) && !do_deinterlace;
if (codec->type == AVMEDIA_TYPE_VIDEO && ist->dr1) {
ist->st->codec->get_buffer = codec_get_buffer;
ist->st->codec->release_buffer = codec_release_buffer;
}
memcpy(codec->extradata, icodec->extradata, icodec->extradata_size);
codec->extradata_size= icodec->extradata_size;
+ codec->bits_per_coded_sample = icodec->bits_per_coded_sample;
codec->time_base = ist->st->time_base;
/*
codec->frame_size = icodec->frame_size;
codec->audio_service_type = icodec->audio_service_type;
codec->block_align = icodec->block_align;
+ if(codec->block_align == 1 && codec->codec_id == CODEC_ID_MP3)
+ codec->block_align= 0;
+ if(codec->codec_id == CODEC_ID_AC3)
+ codec->block_align= 0;
break;
case AVMEDIA_TYPE_VIDEO:
codec->pix_fmt = icodec->pix_fmt;
video_enc->bits_per_raw_sample = frame_bits_per_raw_sample;
MATCH_PER_STREAM_OPT(frame_pix_fmts, str, frame_pix_fmt, oc, st);
+ if (frame_pix_fmt && *frame_pix_fmt == '+') {
+ ost->keep_pix_fmt = 1;
+ if (!*++frame_pix_fmt)
+ frame_pix_fmt = NULL;
+ }
if (frame_pix_fmt && (video_enc->pix_fmt = av_get_pix_fmt(frame_pix_fmt)) == PIX_FMT_NONE) {
av_log(NULL, AV_LOG_FATAL, "Unknown pixel format requested: %s.\n", frame_pix_fmt);
exit_program(1);