diff options
author | Michael Niedermayer <michaelni@gmx.at> | 2012-06-11 05:00:28 +0400 |
---|---|---|
committer | Michael Niedermayer <michaelni@gmx.at> | 2012-06-11 05:00:28 +0400 |
commit | 0478d5f9fe3d6d80b82c18dc5deb4f4661da73ab (patch) | |
tree | 0da749502dadfd9a9abce95b13fabf02d8cbcd53 /ffmpeg.c | |
parent | cb7f06228658b5d31290f245b8e7a4eba2c6758d (diff) |
ffmpeg: allow overriding framerate for stream copy
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'ffmpeg.c')
-rw-r--r-- | ffmpeg.c | 19 |
1 files changed, 12 insertions, 7 deletions
@@ -2870,6 +2870,10 @@ static int transcode_init(void) codec->time_base.num *= icodec->ticks_per_frame; } } + + if(ost->frame_rate.num) + codec->time_base = (AVRational){ost->frame_rate.den, ost->frame_rate.num}; + av_reduce(&codec->time_base.num, &codec->time_base.den, codec->time_base.num, codec->time_base.den, INT_MAX); @@ -4573,25 +4577,26 @@ static OutputStream *new_video_stream(OptionsContext *o, AVFormatContext *oc, in AVStream *st; OutputStream *ost; AVCodecContext *video_enc; + char *frame_rate = NULL; ost = new_output_stream(o, oc, AVMEDIA_TYPE_VIDEO, source_index); st = ost->st; video_enc = st->codec; + MATCH_PER_STREAM_OPT(frame_rates, str, frame_rate, oc, st); + if (frame_rate && av_parse_video_rate(&ost->frame_rate, frame_rate) < 0) { + av_log(NULL, AV_LOG_FATAL, "Invalid framerate value: %s\n", frame_rate); + exit_program(1); + } + if (!ost->stream_copy) { const char *p = NULL; - char *forced_key_frames = NULL, *frame_rate = NULL, *frame_size = NULL; + char *forced_key_frames = NULL, *frame_size = NULL; char *frame_aspect_ratio = NULL, *frame_pix_fmt = NULL; char *intra_matrix = NULL, *inter_matrix = NULL; const char *filters = "null"; int i; - MATCH_PER_STREAM_OPT(frame_rates, str, frame_rate, oc, st); - if (frame_rate && av_parse_video_rate(&ost->frame_rate, frame_rate) < 0) { - av_log(NULL, AV_LOG_FATAL, "Invalid framerate value: %s\n", frame_rate); - exit_program(1); - } - MATCH_PER_STREAM_OPT(frame_sizes, str, frame_size, oc, st); if (frame_size && av_parse_video_size(&video_enc->width, &video_enc->height, frame_size) < 0) { av_log(NULL, AV_LOG_FATAL, "Invalid frame size: %s.\n", frame_size); |