It's broken with multiple files or video streams.
Anton Khirnov authored on 2011/06/15 15:00:03... | ... |
@@ -2192,6 +2192,10 @@ static int transcode(AVFormatContext **output_files, |
2192 | 2192 |
ost->resample_channels = icodec->channels; |
2193 | 2193 |
break; |
2194 | 2194 |
case AVMEDIA_TYPE_VIDEO: |
2195 |
+ if (codec->pix_fmt == PIX_FMT_NONE) |
|
2196 |
+ codec->pix_fmt = icodec->pix_fmt; |
|
2197 |
+ choose_pixel_fmt(ost->st, ost->enc); |
|
2198 |
+ |
|
2195 | 2199 |
if (ost->st->codec->pix_fmt == PIX_FMT_NONE) { |
2196 | 2200 |
fprintf(stderr, "Video pixel format is unknown, stream cannot be encoded\n"); |
2197 | 2201 |
ffmpeg_exit(1); |
... | ... |
@@ -3295,7 +3299,6 @@ static int opt_input_file(const char *opt, const char *filename) |
3295 | 3295 |
set_context_opts(dec, avcodec_opts[AVMEDIA_TYPE_VIDEO], AV_OPT_FLAG_VIDEO_PARAM | AV_OPT_FLAG_DECODING_PARAM, input_codecs[nb_input_codecs-1]); |
3296 | 3296 |
frame_height = dec->height; |
3297 | 3297 |
frame_width = dec->width; |
3298 |
- frame_pix_fmt = dec->pix_fmt; |
|
3299 | 3298 |
rfps = ic->streams[i]->r_frame_rate.num; |
3300 | 3299 |
rfps_base = ic->streams[i]->r_frame_rate.den; |
3301 | 3300 |
if (dec->lowres) { |
... | ... |
@@ -3348,6 +3351,7 @@ static int opt_input_file(const char *opt, const char *filename) |
3348 | 3348 |
|
3349 | 3349 |
video_channel = 0; |
3350 | 3350 |
frame_rate = (AVRational){0, 0}; |
3351 |
+ frame_pix_fmt = PIX_FMT_NONE; |
|
3351 | 3352 |
audio_sample_rate = 0; |
3352 | 3353 |
audio_channels = 0; |
3353 | 3354 |
|
... | ... |
@@ -3471,8 +3475,6 @@ static void new_video_stream(AVFormatContext *oc, int file_idx) |
3471 | 3471 |
video_enc->pix_fmt = frame_pix_fmt; |
3472 | 3472 |
st->sample_aspect_ratio = video_enc->sample_aspect_ratio; |
3473 | 3473 |
|
3474 |
- choose_pixel_fmt(st, codec); |
|
3475 |
- |
|
3476 | 3474 |
if (intra_only) |
3477 | 3475 |
video_enc->gop_size = 0; |
3478 | 3476 |
if (video_qscale || same_quality) { |