HydrogenAudio

Lossy Audio Compression => Opus => Topic started by: neoclo on 2021-05-06 16:34:59

Title: Reduce cover size when converting from Flac. [need help]
Post by: neoclo on 2021-05-06 16:34:59
Hello everybody.

I want to convert Flac files using opusenc from the opus tools, applying the images in downsized format to save additional disk space.
My command so far looks like this: opusenc "/path1/file.flac" "path2/file.opus" –bitrate bitrate
Is there a possibility to transfer the images contained in the FLAC file directly during the conversion in resized format?
Since I did not find out, I wanted to proceed like this:
1 Extract images from Flac (works e.g. without loss via exiftool)
2 adjust images (not the problem)
3 overwrite pictures or delete them from Opus and add the modified ones
I just can't get the last step right. The command to write images in Opus files with opusenc fails with my input because I’m unable to get the syntax correct (Error: cannot open file: 0):
opusenc "/path1/file.opus" --picture 0 |||| "/path1/file.jpeg

quote][...] The
  SPECIFICATION is a string whose parts are separated by | (pipe)
  characters. Some parts may be left empty to invoke default values.
  A plain FILENAME is just shorthand for "||||FILENAME".

  The format of SPECIFICATION is:
  [TYPE]|[MEDIA-TYPE]|[DESCRIPTION]|[WIDTHxHEIGHTxDEPTH[/COLORS]]|FILENAME“ [...][/quote]

Also, I don't know how to remove the larger resolution images from the Opus.
For certain reasons I don't want to modify the Flac files, so I don't want to apply the adjustment of the images to them, nor to a copy of them.

I would appreciate a hint for the correct application of the above command. Best would be the possibility to reduce the size of the images directly during the conversion. Otherwise I would have to remove the images before applying the command and would need a nudge in the right direction to do so too. (I don't want to use programs like puddletag or mp3tag because I have to edit many files in bulk.)
Title: Re: Reduce cover size when converting from Flac. [need help]
Post by: Mark7 on 2021-05-06 22:06:47
I haven't verified myself but i think your quotes are at the wrong place.

Try these commands:
opusenc "/path1/file.opus" --picture "0||||/path1/file.jpeg“
opusenc "/path1/file.opus" --picture "||||/path1/file.jpeg“
opusenc "/path1/file.opus" --picture "||||file.jpeg“

And try this one to remove (avoid) the original picture
--discard-pictures

https://opus-codec.org/docs/opus-tools/opusenc.html
Title: Re: Reduce cover size when converting from Flac. [need help]
Post by: neoclo on 2021-05-06 22:39:56
The syntax is now correct, I guess.
Now I only get errors that the image files cannot be opened.
Error: cannot open file: '/path1/file.jpeg' or Error: cannot open file: 'file.jpeg' (with both --picture "||||'/path1/file.jpeg'" and --picture "||||'file.jpeg'")
The image format and other image files do not matter.

The option --discard-pictures works fine.
Thanks a lot
Title: Re: Reduce cover size when converting from Flac. [need help]
Post by: neoclo on 2021-05-08 07:57:58
I have now tried the following syntax, but each time nothing happens with the files, but only opusenc is called and lists all possible commands.
opusenc '/home/user/title.opus'  --picture "||||/home/user/title.jpeg"
opusenc.exe 'D:\title.opus'  --picture "||||D:\title.jpeg"
No matter if Windows or Linux and also with different files.
If anyone knows what this could be due to, I would be grateful.
Title: Re: Reduce cover size when converting from Flac. [need help]
Post by: neoclo on 2021-05-09 13:58:11
I have now tried the following syntax, but each time nothing happens with the files, but only opusenc is called and lists all possible commands.
opusenc '/home/user/title.opus'  --picture "||||/home/user/title.jpeg"
opusenc.exe 'D:\title.opus'  --picture "||||D:\title.jpeg"
No matter if Windows or Linux and also with different files.
If anyone knows what this could be due to, I would be grateful.

In case anyone ever has the same trouble:
The command --picture "||||/path/image" works only during conversion. In combination with --discard-pictures the image is then the only image in the Opus.
SimplePortal 1.0.0 RC1 © 2008-2021