Transcode fails when album art is a video track with odd numbered width/height. #1

Closed
opened 2023-10-18 15:02:49 +01:00 by chaos · 2 comments
Owner

To fix this we need to transcode the album art to a more supported format which requires analyzing first with ffprobe and adding extra arguments or transcode steps to convert the video track to a suitable format, applying slight downscale/crop to match format-appropriate values.

We should also add a command which fixes album art on all files to be the appropriate album art format for the container so that album art doesn't need to be re-transcoded every time transcode is run. This should also be added to the process command as well.

We should aim to only use static image formats where possible as this should be more efficient. For example use JPEG or PNG when using mka/mkv only.

Failed Example:

Transcoding
Input #0, flac, from '/home/chaos/Music/vibes/speedy/slower/Akira Complex - Ether Strike.flac':
  Metadata:
    ORGANIZATION    : lowiro
    ARTIST          : Akira Complex
    ENCODER         : reference libFLAC 1.3.1 20141125
    REPLAYGAIN_TRACK_GAIN: -10.90 dB
    DISPLAY ARTIST  : Akira Complex
    DISCTOTAL       : 1
    CONTENTGROUP    : arcaea
    REPLAYGAIN_TRACK_PEAK: 1.244515
    TITLE           : Ether Strike
    COMMENT         : English tracklist https://vgmdb.net/album/91876
    TRACKTOTAL      : 25
    ALBUMSORT       : Arcaea 01
  Duration: 00:02:22.15, start: 0.000000, bitrate: 1178 kb/s
  Stream #0:0: Audio: flac, 44100 Hz, stereo, s16
    Side data:
      replaygain: track gain - -10.900000, track peak - 0.000029, album gain - unknown, album peak - unknown, 
  Stream #0:1: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 843x750 [SAR 96:96 DAR 281:250], 90k tbr, 90k tbn (attached pic)
    Metadata:
      comment         : Cover (front)
Stream mapping:
  Stream #0:1 -> #0:0 (mjpeg (native) -> h264 (libx264))
  Stream #0:0 -> #0:1 (flac (native) -> adpcm_g726 (g726))
Press [q] to stop, [?] for help
[libx264 @ 0xc842c0] width not divisible by 2 (843x750)
Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height
To fix this we need to transcode the album art to a more supported format which requires analyzing first with ffprobe and adding extra arguments or transcode steps to convert the video track to a suitable format, applying slight downscale/crop to match format-appropriate values. We should also add a command which fixes album art on all files to be the appropriate album art format for the container so that album art doesn't need to be re-transcoded every time transcode is run. This should also be added to the process command as well. We should aim to only use static image formats where possible as this should be more efficient. For example use JPEG or PNG when using mka/mkv only. Failed Example: ``` Transcoding Input #0, flac, from '/home/chaos/Music/vibes/speedy/slower/Akira Complex - Ether Strike.flac': Metadata: ORGANIZATION : lowiro ARTIST : Akira Complex ENCODER : reference libFLAC 1.3.1 20141125 REPLAYGAIN_TRACK_GAIN: -10.90 dB DISPLAY ARTIST : Akira Complex DISCTOTAL : 1 CONTENTGROUP : arcaea REPLAYGAIN_TRACK_PEAK: 1.244515 TITLE : Ether Strike COMMENT : English tracklist https://vgmdb.net/album/91876 TRACKTOTAL : 25 ALBUMSORT : Arcaea 01 Duration: 00:02:22.15, start: 0.000000, bitrate: 1178 kb/s Stream #0:0: Audio: flac, 44100 Hz, stereo, s16 Side data: replaygain: track gain - -10.900000, track peak - 0.000029, album gain - unknown, album peak - unknown, Stream #0:1: Video: mjpeg (Baseline), yuvj420p(pc, bt470bg/unknown/unknown), 843x750 [SAR 96:96 DAR 281:250], 90k tbr, 90k tbn (attached pic) Metadata: comment : Cover (front) Stream mapping: Stream #0:1 -> #0:0 (mjpeg (native) -> h264 (libx264)) Stream #0:0 -> #0:1 (flac (native) -> adpcm_g726 (g726)) Press [q] to stop, [?] for help [libx264 @ 0xc842c0] width not divisible by 2 (843x750) Error initializing output stream 0:0 -- Error while opening encoder for output stream #0:0 - maybe incorrect parameters such as bit_rate, rate, width or height ```
chaos added the due date 2023-12-01 2023-10-18 15:03:17 +01:00
Author
Owner

Analyzing the file first isn't required when using jpeg/png as codec but is when using x264 and odd numbered height/width.

Analyzing the file first isn't required when using jpeg/png as codec but is when using x264 and odd numbered height/width.
Author
Owner

Fixed in commit 4b6ad42

Fixed in commit 4b6ad42
chaos closed this issue 2023-10-20 16:52:36 +01:00
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

2023-12-01

Dependencies

No dependencies set.

Reference: chaos/musicutil#1
No description provided.