Opened 5 years ago

Last modified 5 years ago

#2270 open defect

ffmpeg transcodes cover art to a video stream with a single frame

Reported by: gjdfgh Owned by:
Priority: normal Component: avformat
Version: git-master Keywords:
Cc: onemda@gmail.com Blocked By:
Blocking: Reproduced by developer: yes
Analyzed by developer: yes

Description

$ ffmpeg -i tests/sample.mp3 out.mkv 
ffmpeg version 1.0.3 Copyright (c) 2000-2012 the FFmpeg developers
  built on Jan 24 2013 14:52:18 with gcc 4.7 (Debian 4.7.2-5)
  configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/i386-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libdc1394 --disable-altivec --disable-armv5te --disable  libavutil      51. 73.101 / 51. 73.101
  libavcodec     54. 59.100 / 54. 59.100
  libavformat    54. 29.104 / 54. 29.104
  libavdevice    54.  2.101 / 54.  2.101
  libavfilter     3. 17.100 /  3. 17.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[mp3 @ 0x8091a60] max_analyze_duration 5000000 reached at 5015510
[mp3 @ 0x8091a60] Estimating duration from bitrate, this may be inaccurate
Input #0, mp3, from 'tests/sample.mp3':
  Metadata:
    album_artist    : Armin Van Buuren
    track           : 26
    encoded_by      : Https://Www.Facebook.Com/Inspirontrance
    title           : Serenity (Andrew Rayel Aether Remix) [Future Favorite]
    artist          : Armin Van Buuren Feat. Jan Vayne
    album           : A State Of Trance Episode 587 (2012-11-15)
    genre           : Trance
    date            : 2012

  Duration: 00:05:20.20, start: 0.000000, bitrate: 255 kb/s
    Stream #0:0: Audio: mp3, 44100 Hz, stereo, s16, 256 kb/s
    Stream #0:1: Video: mjpeg, yuvj444p, 720x720 [SAR 72:72 DAR 1:1], 90k tbr, 90k tbn, 90k tbc
    Metadata:
      title           : 
      comment         : Cover (front)
[libx264 @ 0x80a82e0] using SAR=1/1
[libx264 @ 0x80a82e0] MB rate (182250000) > level limit (2073600)
[libx264 @ 0x80a82e0] using cpu capabilities: MMX2 SSE2Fast SSSE3 Cache64
[libx264 @ 0x80a82e0] profile High, level 5.2
[libx264 @ 0x80a82e0] 264 - core 129 - H.264/MPEG-4 AVC codec - Copyleft 2003-2013 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=3 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, matroska, to 'out.mkv':
  Metadata:
    album_artist    : Armin Van Buuren
    PART_NUMBER     : 26
    encoded_by      : Https://Www.Facebook.Com/Inspirontrance
    title           : Serenity (Andrew Rayel Aether Remix) [Future Favorite]
    artist          : Armin Van Buuren Feat. Jan Vayne
    album           : A State Of Trance Episode 587 (2012-11-15)
    genre           : Trance
    date            : 2012
    encoder         : Lavf54.29.104
    Stream #0:0: Video: h264 (H264 / 0x34363248), yuvj420p, 720x720 [SAR 1:1 DAR 1:1], q=-1--1, 1k tbn, 90k tbc
    Metadata:
      title           : 
      comment         : Cover (front)
    Stream #0:1: Audio: vorbis (oV[0][0] / 0x566F), 44100 Hz, stereo, flt
Stream mapping:
  Stream #0:1 -> #0:0 (mjpeg -> libx264)
  Stream #0:0 -> #0:1 (mp3 -> libvorbis)
Press [q] to stop, [?] for help
frame=    1 fps=0.1 q=33.0 Lsize=    4410kB time=00:05:12.99 bitrate= 115.4kbits/s    
video:11kB audio:4276kB subtitle:0 global headers:4kB muxing overhead 2.766691%

[libx264 @ 0x80a82e0] frame I:1     Avg QP:31.73  size: 10211
[libx264 @ 0x80a82e0] mb I  I16..4: 46.9% 35.0% 18.1%
[libx264 @ 0x80a82e0] 8x8 transform intra:35.0%
[libx264 @ 0x80a82e0] coded y,uvDC,uvAC intra: 26.8% 8.9% 3.2%
[libx264 @ 0x80a82e0] i16 v,h,dc,p: 70% 16%  7%  7%
[libx264 @ 0x80a82e0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 14% 23%  4%  5% 11%  5%  6%  5%
[libx264 @ 0x80a82e0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 40% 20% 13%  4%  5%  7%  4%  4%  3%
[libx264 @ 0x80a82e0] i8c dc,h,v,p: 91%  4%  5%  0%
[libx264 @ 0x80a82e0] kb/s:7351920.00
$ ffprobe out.mkv 
ffprobe version 1.0.3 Copyright (c) 2007-2012 the FFmpeg developers
  built on Jan 24 2013 14:52:18 with gcc 4.7 (Debian 4.7.2-5)
  configuration: --prefix=/usr --extra-cflags='-g -O2 -fstack-protector --param=ssp-buffer-size=4 -Wformat -Werror=format-security ' --extra-ldflags='-Wl,-z,relro' --cc='ccache cc' --enable-shared --enable-libmp3lame --enable-gpl --enable-nonfree --enable-libvorbis --enable-pthreads --enable-libfaac --enable-libxvid --enable-postproc --enable-x11grab --enable-libgsm --enable-libtheora --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libx264 --enable-libspeex --enable-nonfree --disable-stripping --enable-libvpx --enable-libschroedinger --disable-encoder=libschroedinger --enable-version3 --enable-libopenjpeg --enable-librtmp --enable-avfilter --enable-libfreetype --enable-libvo-aacenc --disable-decoder=amrnb --enable-libvo-amrwbenc --enable-libaacplus --libdir=/usr/lib/i386-linux-gnu --disable-vda --enable-libbluray --enable-libcdio --enable-gnutls --enable-frei0r --enable-openssl --enable-libass --enable-libopus --enable-fontconfig --enable-libdc1394 --disable-altivec --disable-armv5te --disable  libavutil      51. 73.101 / 51. 73.101
  libavcodec     54. 59.100 / 54. 59.100
  libavformat    54. 29.104 / 54. 29.104
  libavdevice    54.  2.101 / 54.  2.101
  libavfilter     3. 17.100 /  3. 17.100
  libswscale      2.  1.101 /  2.  1.101
  libswresample   0. 15.100 /  0. 15.100
  libpostproc    52.  0.100 / 52.  0.100
[matroska,webm @ 0x807f6e0] max_analyze_duration 5000000 reached at 5017000
Input #0, matroska,webm, from 'out.mkv':
  Metadata:
    title           : Serenity (Andrew Rayel Aether Remix) [Future Favorite]
    ALBUM_ARTIST    : Armin Van Buuren
    track           : 26
    ENCODED_BY      : Https://Www.Facebook.Com/Inspirontrance
    ARTIST          : Armin Van Buuren Feat. Jan Vayne
    ALBUM           : A State Of Trance Episode 587 (2012-11-15)
    GENRE           : Trance
    DATE            : 2012
    ENCODER         : Lavf54.29.104
  Duration: 00:05:13.54, start: 0.000000, bitrate: 115 kb/s
    Stream #0:0: Video: h264 (High), yuvj420p, 720x720 [SAR 1:1 DAR 1:1], 30k fps, 30k tbr, 1k tbn, 180k tbc
    Metadata:
      title           : 
      COMMENT         : Cover (front)
    Stream #0:1: Audio: vorbis, 44100 Hz, stereo, s16 (default)

It should create an audio-only mkv with the picture embedded as metadata instead. Should it turn out that mkv does not have anything like image data in metadata, ffmpeg should not create a video stream anyway.

Change History (5)

comment:1 in reply to: ↑ description Changed 5 years ago by cehoyos

Replying to gjdfgh:

It should create an audio-only mkv with the picture embedded as metadata instead.

Why?

comment:2 Changed 5 years ago by heleppkes

The original file has an attached coverart in metadata, and when transcoding this, why would the target file be any different? (And yes, MKV has this concept)

Not to mention that a video stream with only one frame breaks seeking in the file in many players, because they try to seek to video.

comment:3 Changed 5 years ago by gjdfgh

And yes, the AV_DISPOSITION_ATTACHED_PIC flag is set on the input "video" stream. It just isn't printed by ffmpeg, apparently. The output has it not set.

comment:4 Changed 5 years ago by cehoyos

  • Priority changed from normal to wish
  • Status changed from new to open
  • Type changed from defect to enhancement
  • Version changed from unspecified to git-master

comment:5 Changed 5 years ago by richardpl

  • Analyzed by developer set
  • Cc onemda@gmail.com added
  • Component changed from undetermined to avformat
  • Priority changed from wish to normal
  • Reproduced by developer set
  • Type changed from enhancement to defect
Note: See TracTickets for help on using tickets.