You've already forked FFmpeg
mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2025-08-15 14:13:16 +02:00
img2: stop using CODEC_ID_RAWVIDEO to trigger processing of independant y/u/v image files
This is requireed, as img2 will be modified soon to support .raw image file sequences. Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
This commit is contained in:
committed by
Michael Niedermayer
parent
1e96d4c71e
commit
0bb240acb3
@@ -141,6 +141,12 @@ Note also that the pattern must not necessarily contain "%d" or
|
|||||||
ffmpeg -i in.avi -f image2 -vframes 1 img.jpeg
|
ffmpeg -i in.avi -f image2 -vframes 1 img.jpeg
|
||||||
@end example
|
@end example
|
||||||
|
|
||||||
|
The image muxer supports the .Y.U.V image file format. This format is
|
||||||
|
special in that that each image frame consists of three files, for
|
||||||
|
each of the YUV420P components. To read or write this image file format,
|
||||||
|
specify the name of the '.Y' file. The muxer will automatically open the
|
||||||
|
'.U' and '.V' files as required.
|
||||||
|
|
||||||
@section mpegts
|
@section mpegts
|
||||||
|
|
||||||
MPEG transport stream muxer.
|
MPEG transport stream muxer.
|
||||||
|
@@ -32,6 +32,7 @@ typedef struct {
|
|||||||
int img_number;
|
int img_number;
|
||||||
int img_count;
|
int img_count;
|
||||||
int is_pipe;
|
int is_pipe;
|
||||||
|
int split_planes; /**< use independent file for each Y, U, V plane */
|
||||||
char path[1024];
|
char path[1024];
|
||||||
} VideoData;
|
} VideoData;
|
||||||
|
|
||||||
@@ -241,6 +242,8 @@ static int read_header(AVFormatContext *s1, AVFormatParameters *ap)
|
|||||||
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
|
st->codec->codec_type = AVMEDIA_TYPE_AUDIO;
|
||||||
st->codec->codec_id = s1->audio_codec_id;
|
st->codec->codec_id = s1->audio_codec_id;
|
||||||
}else{
|
}else{
|
||||||
|
const char *str= strrchr(s->path, '.');
|
||||||
|
s->split_planes = str && !strcasecmp(str + 1, "y");
|
||||||
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
|
st->codec->codec_type = AVMEDIA_TYPE_VIDEO;
|
||||||
st->codec->codec_id = av_str2id(img_tags, s->path);
|
st->codec->codec_id = av_str2id(img_tags, s->path);
|
||||||
}
|
}
|
||||||
@@ -278,7 +281,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
|
|||||||
}
|
}
|
||||||
size[i]= avio_size(f[i]);
|
size[i]= avio_size(f[i]);
|
||||||
|
|
||||||
if(codec->codec_id != CODEC_ID_RAWVIDEO)
|
if(!s->split_planes)
|
||||||
break;
|
break;
|
||||||
filename[ strlen(filename) - 1 ]= 'U' + i;
|
filename[ strlen(filename) - 1 ]= 'U' + i;
|
||||||
}
|
}
|
||||||
@@ -324,6 +327,7 @@ static int read_packet(AVFormatContext *s1, AVPacket *pkt)
|
|||||||
static int write_header(AVFormatContext *s)
|
static int write_header(AVFormatContext *s)
|
||||||
{
|
{
|
||||||
VideoData *img = s->priv_data;
|
VideoData *img = s->priv_data;
|
||||||
|
const char *str;
|
||||||
|
|
||||||
img->img_number = 1;
|
img->img_number = 1;
|
||||||
av_strlcpy(img->path, s->filename, sizeof(img->path));
|
av_strlcpy(img->path, s->filename, sizeof(img->path));
|
||||||
@@ -334,6 +338,8 @@ static int write_header(AVFormatContext *s)
|
|||||||
else
|
else
|
||||||
img->is_pipe = 1;
|
img->is_pipe = 1;
|
||||||
|
|
||||||
|
str = strrchr(img->path, '.');
|
||||||
|
img->split_planes = str && !strcasecmp(str + 1, "y");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -359,7 +365,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
return AVERROR(EIO);
|
return AVERROR(EIO);
|
||||||
}
|
}
|
||||||
|
|
||||||
if(codec->codec_id != CODEC_ID_RAWVIDEO)
|
if(!img->split_planes)
|
||||||
break;
|
break;
|
||||||
filename[ strlen(filename) - 1 ]= 'U' + i;
|
filename[ strlen(filename) - 1 ]= 'U' + i;
|
||||||
}
|
}
|
||||||
@@ -367,7 +373,7 @@ static int write_packet(AVFormatContext *s, AVPacket *pkt)
|
|||||||
pb[0] = s->pb;
|
pb[0] = s->pb;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(codec->codec_id == CODEC_ID_RAWVIDEO){
|
if(img->split_planes){
|
||||||
int ysize = codec->width * codec->height;
|
int ysize = codec->width * codec->height;
|
||||||
avio_write(pb[0], pkt->data , ysize);
|
avio_write(pb[0], pkt->data , ysize);
|
||||||
avio_write(pb[1], pkt->data + ysize, (pkt->size - ysize)/2);
|
avio_write(pb[1], pkt->data + ysize, (pkt->size - ysize)/2);
|
||||||
|
Reference in New Issue
Block a user