[FFmpeg-devel] [PATCH] [RFC] avformat/movenc: support writing iTunes cover image
Michael Niedermayer
michael at niedermayer.cc
Sat Mar 31 03:13:14 EEST 2018
On Thu, Mar 29, 2018 at 09:45:13AM +0300, Timo Teräs wrote:
> Fixes https://trac.ffmpeg.org/ticket/2798
>
> This makes movenc handle AV_DISPOSITION_ATTACHED_PIC and write
> the associated pictures in iTunes cover atom. This corresponds
> to how 'mov' demuxer parses and exposes the cover images when
> reading.
>
> Tested to produce valid stream with:
> ffmpeg -i movie.mp4 -i thumb.jpg -disposition:v:1 attached_pic
> -map 0 -map 1 -c copy out.mp4
>
> The cover image is also copied corretly with:
> ffmpeg -i movie.mp4 -map 0 -c copy out.mp4
>
> AtomicParseley says that the attached_pic stream is properly
> not visible in the main tracks of the file. Though, I am not
> sure if there's any side-effects of having internal stream
> without any packets. We may need to arm the mov muxer with
> additional checks for streams without any packets.
>
> It may make sense to move the code in mov_write_packet() that
> grabs the attached picture to generic code in mux.c. Seems there's
> currently no other muxer supporting cover images than mp3 and
> it seems to use special code to handle them.
>
> Signed-off-by: Timo Teräs <timo.teras at iki.fi>
> Cc: Matthieu Bouron <matthieu.bouron at gmail.com>
> ---
> fftools/ffmpeg.c | 1 +
> libavformat/movenc.c | 67 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 68 insertions(+)
[...]
> @@ -3451,6 +3499,7 @@ static int mov_write_ilst_tag(AVIOContext *pb, MOVMuxContext *mov,
> mov_write_int8_metadata (s, pb, "hdvd", "hd_video", 1);
> mov_write_int8_metadata (s, pb, "pgap", "gapless_playback",1);
> mov_write_int8_metadata (s, pb, "cpil", "compilation", 1);
> + mov_write_covr(pb, s);
> mov_write_trkn_tag(pb, mov, s, 0); // track number
> mov_write_trkn_tag(pb, mov, s, 1); // disc number
> mov_write_tmpo_tag(pb, s);
> @@ -5480,6 +5529,24 @@ static int mov_write_packet(AVFormatContext *s, AVPacket *pkt)
> if (!pkt) {
> mov_flush_fragment(s, 1);
> return 1;
> + } if (s->streams[pkt->stream_index]->disposition & AV_DISPOSITION_ATTACHED_PIC) {
The if() should be in the next line or it should be a else if
it looks like someone forgot a "else" even though it makes no
difference here.
thanks
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
I do not agree with what you have to say, but I'll defend to the death your
right to say it. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20180331/4f75dc25/attachment.sig>
More information about the ffmpeg-devel
mailing list