Re: [FFmpeg-devel] [PATCH] avformat/avienc: store palette at keyframes if it differs from the global one
On 03/05/2016 10:26 PM, Mats Peterson wrote: On 03/05/2016 10:13 PM, Mats Peterson wrote: On 03/05/2016 10:12 PM, Mats Peterson wrote: Doesn't seem to work quite as expected, Michael. Try ffmpeg -i toon.avi -vcodec copy out.avi. The destination file will still contain only two xxpc chunks. Mats Well, it works with -vcodec rawvideo, but not -vcodec copy. Mats On stream copy, the palette won't come with every packet like it does for e.g. "-vcodec rawvideo". So you'll need to add the keyframe xxpc chunks outside of the "if (ret2)" block in some way. Mats Not only stream copy by the way, but any non-raw codec. Mats -- Mats Peterson http://matsp888.no-ip.org/~mats/ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/avienc: store palette at keyframes if it differs from the global one
On 03/05/2016 10:13 PM, Mats Peterson wrote: On 03/05/2016 10:12 PM, Mats Peterson wrote: Doesn't seem to work quite as expected, Michael. Try ffmpeg -i toon.avi -vcodec copy out.avi. The destination file will still contain only two xxpc chunks. Mats Well, it works with -vcodec rawvideo, but not -vcodec copy. Mats On stream copy, the palette won't come with every packet like it does for e.g. "-vcodec rawvideo". So you'll need to add the keyframe xxpc chunks outside of the "if (ret2)" block in some way. Mats -- Mats Peterson http://matsp888.no-ip.org/~mats/ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/avienc: store palette at keyframes if it differs from the global one
On 03/05/2016 10:12 PM, Mats Peterson wrote: Doesn't seem to work quite as expected, Michael. Try ffmpeg -i toon.avi -vcodec copy out.avi. The destination file will still contain only two xxpc chunks. Mats Well, it works with -vcodec rawvideo, but not -vcodec copy. Mats -- Mats Peterson http://matsp888.no-ip.org/~mats/ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
Re: [FFmpeg-devel] [PATCH] avformat/avienc: store palette at keyframes if it differs from the global one
On 03/05/2016 08:44 PM, Michael Niedermayer wrote: --- libavformat/avienc.c |9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 0cfffb7..8804ece 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -84,6 +84,7 @@ typedef struct AVIStream { uint32_t palette[AVPALETTE_COUNT]; uint32_t old_palette[AVPALETTE_COUNT]; +uint32_t global_palette[AVPALETTE_COUNT]; int64_t pal_offset; } AVIStream; @@ -711,9 +712,15 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) } avio_seek(pb, cur_offset, SEEK_SET); memcpy(avist->old_palette, avist->palette, pal_size * 4); +memcpy(avist->global_palette, avist->palette, pal_size * 4); avist->pal_offset = 0; } -if (memcmp(avist->palette, avist->old_palette, pal_size * 4)) { +if (memcmp(avist->palette, avist->old_palette, pal_size * 4) || +(memcmp(avist->palette, avist->global_palette, pal_size * 4) || + avist->strh_flags_offset == 0 || + !pb->seekable +) && (pkt->flags & AV_PKT_FLAG_KEY) +) { avi_stream2fourcc(tag, stream_index, enc->codec_type); tag[2] = 'p'; tag[3] = 'c'; pc_tag = ff_start_tag(pb, tag); Doesn't seem to work quite as expected, Michael. Try ffmpeg -i toon.avi -vcodec copy out.avi. The destination file will still contain only two xxpc chunks. Mats -- Mats Peterson http://matsp888.no-ip.org/~mats/ ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
[FFmpeg-devel] [PATCH] avformat/avienc: store palette at keyframes if it differs from the global one
--- libavformat/avienc.c |9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/libavformat/avienc.c b/libavformat/avienc.c index 0cfffb7..8804ece 100644 --- a/libavformat/avienc.c +++ b/libavformat/avienc.c @@ -84,6 +84,7 @@ typedef struct AVIStream { uint32_t palette[AVPALETTE_COUNT]; uint32_t old_palette[AVPALETTE_COUNT]; +uint32_t global_palette[AVPALETTE_COUNT]; int64_t pal_offset; } AVIStream; @@ -711,9 +712,15 @@ static int avi_write_packet(AVFormatContext *s, AVPacket *pkt) } avio_seek(pb, cur_offset, SEEK_SET); memcpy(avist->old_palette, avist->palette, pal_size * 4); +memcpy(avist->global_palette, avist->palette, pal_size * 4); avist->pal_offset = 0; } -if (memcmp(avist->palette, avist->old_palette, pal_size * 4)) { +if (memcmp(avist->palette, avist->old_palette, pal_size * 4) || +(memcmp(avist->palette, avist->global_palette, pal_size * 4) || + avist->strh_flags_offset == 0 || + !pb->seekable +) && (pkt->flags & AV_PKT_FLAG_KEY) +) { avi_stream2fourcc(tag, stream_index, enc->codec_type); tag[2] = 'p'; tag[3] = 'c'; pc_tag = ff_start_tag(pb, tag); -- 1.7.9.5 ___ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel