bash - avconv : flac to ogg conversion with metadata kept -


i'm writing command line tool convert input music library various formats (flac / ogg / mp3 / ...) output music library of given format (flac / ogg / mp3). i've based on avconv (or ffmpeg if avconv not available) since complete command line converter i've found. script available @ url (github):

https://github.com/biapy/howto.biapy.com/blob/master/various/mussync-tools

i'm trying pass metadata input library files output/converted library files.

i've come code:

 local map_metadata=' 0:g'   # specific needs input formats/   case "${input_file_mimetype}" in     'application/ogg' )       # input metadata first audio stream , direct global.       map_metadata=' 0:s:0'       ;;      * )       # nothing.       # map_metadata=' 0:g'       ;;   esac    # specific needs output formats/   local output_options=""   case "${output_format}" in     'flac' )       # no encoding options needed.       encoding_options=""       ;;      'ogg' )       # set vorbis default codec ogg.       output_options="-codec:a libvorbis -f ${output_format}"       # map input metadata audio streams in ogg container.       map_metadata=":s:a ${map_metadata}"       ;;      * )       # nothing.       # map_metadata="${map_metadata}"       output_options="-f ${output_format}"       ;;   esac    # dangerous solution mp3 cbr format:   # write output on pipe , directed file.   # cbr format mp3 files. harmless other formats.   # see: http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=7&t=377   #   # log output ? how prevent being included in   # resulting output file ?    if ! command ${avconv} -i "${input_file}" \              -vn -sn \             -map_metadata${map_metadata} \             -loglevel "${log_level}" \             ${avconv_options} \             ${output_options} \             ${encoding_options} \             "${output_temp_file}";     test "${quiet}" != 'true' && echo "failed."     test -e "${output_temp_file}" && command rm "${output_temp_file}"      return 1   else     test "${quiet}" != 'true' && echo "done."      # test if fix mp3 vbr needed.     # see: http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=7&t=377     if [ "${output_format}" = 'mp3' -a "${encoding_mode}" != 'cbr' ];       # output file mp3 , vbr. apply header fix.       if [ "${verbose}" = 'true' ];         command vbrfix "${output_temp_file}" "${output_file}"       else         command vbrfix "${output_temp_file}" "${output_file}"       fi     else       # nothing rename file.       command mv "${output_temp_file}" "${output_file}"     fi      # delete temporary file if still present.     test -e "${output_temp_file}" && command rm "${output_temp_file}"      # fetch cover art input file.     transfert_images "${input_file}" "${output_file}"   fi 

my problem when converting flac ogg avconv version available on ubuntu 13.10 saucy salamander, metadata not kept, despite option (copy global metadata input flac file audio streams of output ogg file):

--map_metadata:s:a 0:g 

does 1 of know correct --map_metadata option copying metadata flac input file ogg output file when converting ?

ps: additional question: how prevent avconv generated cbr mp3 files have vbr header ?

pps: i'm aware of tools such beets, i've yet see specialized command line tool task.

found fix here:

https://bugs.kde.org/show_bug.cgi?id=306895

the --map_metadata options are:

  • for ogg : --map_metadata 0:s:0
  • for except ogg ogg : --map_metadata:s:a 0:s:0

note --map_metadata option same when outputing ogg , inputing ogg.

as cbr mp3 files, fix presented here: http://ffmpeg.zeranoe.com/forum/viewtopic.php?f=7&t=37 (output pipe) valid. avconv output log informations &2. &1 free data. edit: fix work cbr mp3, breaks vbr mp3 needs direct output file.

i've integrated changes mussync-tools 1.2.0:

https://github.com/biapy/howto.biapy.com/blob/master/various/mussync-tools


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -