mirror of
				https://github.com/KrumpetPirate/AAXtoMP3.git
				synced 2025-11-03 20:40:43 +01:00 
			
		
		
		
	Merge pull request #182 from Natrinicle/extra-crop-cover-check
Add extra_crop_cover to All Odd Cover Widths
This commit is contained in:
		
							
								
								
									
										19
									
								
								AAXtoMP3
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								AAXtoMP3
									
									
									
									
									
								
							@@ -752,7 +752,6 @@ do
 | 
			
		||||
  fi
 | 
			
		||||
  # Grab the cover art if available.
 | 
			
		||||
  cover_file="${output_directory}/cover.jpg"
 | 
			
		||||
  extra_crop_cover=''
 | 
			
		||||
  if [ "${continue}" == "0" ]; then
 | 
			
		||||
    if [ "${audibleCli}" == "1" ]; then
 | 
			
		||||
      # We have a better quality cover file, copy it.
 | 
			
		||||
@@ -760,12 +759,6 @@ do
 | 
			
		||||
        log "Copy cover file to ${cover_file}..."
 | 
			
		||||
      fi
 | 
			
		||||
      cp "${extra_cover_file}" "${cover_file}"
 | 
			
		||||
 | 
			
		||||
      # We now set a variable, ${extra_crop_cover}, which contains an additional
 | 
			
		||||
      # ffmpeg flag. It crops the cover so the width and the height is divisible by two.
 | 
			
		||||
      # Since the standard (in the aax file) image resolution is 512, we set the flag
 | 
			
		||||
      # only if we use a custom cover art.
 | 
			
		||||
      extra_crop_cover='-vf crop=trunc(iw/2)*2:trunc(ih/2)*2'
 | 
			
		||||
    else
 | 
			
		||||
      # Audible-cli not used, extract the cover from the aax file
 | 
			
		||||
      if [ "$((${loglevel} > 1))" == "1" ]; then
 | 
			
		||||
@@ -775,6 +768,18 @@ do
 | 
			
		||||
    fi
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  extra_crop_cover=''
 | 
			
		||||
  cover_width=$(ffprobe -i "${cover_file}" 2>&1 | grep -Po "[0-9]+(?=x[0-9]+)")
 | 
			
		||||
  if [ "$(( ${cover_width} % 2 ))" == "1" ]; then
 | 
			
		||||
    if [ "$((${loglevel} > 1))" == "1" ]; then
 | 
			
		||||
      log "Cover ${cover_file} has odd width ${cover_width}, setting extra_crop_cover to make even."
 | 
			
		||||
    fi
 | 
			
		||||
    # We now set a variable, ${extra_crop_cover}, which contains an additional
 | 
			
		||||
    # ffmpeg flag. It crops the cover so the width and the height is divisible by two.
 | 
			
		||||
    # Set the flag only if we use a cover art with an odd width.
 | 
			
		||||
    extra_crop_cover='-vf crop=trunc(iw/2)*2:trunc(ih/2)*2'
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  # -----
 | 
			
		||||
  # If mode=chaptered, split the big converted file by chapter and remove it afterwards.
 | 
			
		||||
  # Not all audio encodings make sense with multiple chapter outputs (see options section)
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user