Help

Difference between revisions of "Renaming"

Line 17: Line 17:
  
 
====avconv's output====
 
====avconv's output====
<source class="bash">
+
<source lang="bash">
 
avconv -i ./cmn-jiāoliú.flac 2>&1                      # print out metadata of $file, for some formats only
 
avconv -i ./cmn-jiāoliú.flac 2>&1                      # print out metadata of $file, for some formats only
 
ffmpeg version 2.8.14-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
 
ffmpeg version 2.8.14-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers

Revision as of 14:38, 21 October 2020

Renaming using the file name's fields

Given files names such as ./{codeLang}-{word}-{speaker}-{id}.wav such as ./cmn-quan3-Can_Yue-LL12087.wav :

mkdir -p ./new                                # create dir
for file in ./cmn-*.wav;
do 
   key=$(basename "$file" | cut -d- -f2);     # using "-" as split, select field 2 : "quan3"
   cp "$file" ./new/cmn-"$key".wav;           # ./new/cmn-quan3.wav
done

Renaming using metadata

Dependencies

sudo apt-get install lame avconv                       # examine audio file's properties.

avconv's output

avconv -i ./cmn-jiāoliú.flac 2>&1                       # print out metadata of $file, for some formats only
ffmpeg version 2.8.14-0ubuntu0.16.04.1 Copyright (c) 2000-2018 the FFmpeg developers
  built with gcc 5.4.0 (Ubuntu 5.4.0-6ubuntu1~16.04.9) 20160609
[...]
Input #0, flac, from './cmn-jiāoliú.flac':
  Metadata:
    TITLE           : 交流
    LICENSE         : Creative Commons BY-SA 3.0 U.S
    COPYRIGHT       : (c) 2009 Yue Tan
    ARTIST          : Tan
    DATE            : 2009-07-08
    GENRE           : Speech
    SWAC_LANG       : cmn
    SWAC_TEXT       : 交流
    SWAC_ALPHAIDX   : jiāoliú
    SWAC_SPEAK_NAME : Tan
    SWAC_SPEAK_GENDER: F
    SWAC_SPEAK_BIRTH_YEAR: 1978
    SWAC_SPEAK_LANG : zho
    SWAC_SPEAK_LANG_REGION: Liaoning
    SWAC_SPEAK_LIV_COUNTRY: FR
    SWAC_SPEAK_LIV_TOWN: Caen
    SWAC_PRON_PHON  : jiāoliú
    SWAC_COLL_SECTION: HSK niveau II
    SWAC_COLL_LICENSE: Creative Commons BY-SA 3.0 U.S
    SWAC_COLL_COPYRIGHT: (c) 2009 Yue Tan
    SWAC_TECH_DATE  : 2009-07-08
    SWAC_TECH_SOFT  : Shtooka Recorder/1.3
  Duration: 00:00:01.40, start: 0.000000, bitrate: 447 kb/s
    Stream #0:0: Audio: flac, 44100 Hz, mono, s16

Renaming

mkdir -p ./new                                # create dir
for file in ./cmn-*.flac;
do 
    key=$(avconv -i "$file" 2>&1 | sed -ne 's/.*SWAC_TEXT *: //p')     # print metadata, assign SWAC_TEXT's value to variable.
    cp "$file" ./cmn-$key.flac                                         # ./cmn-交流.flac
done

See also

Lingua Libre technical helps
Template {{Speakers category}} • {{Recommended lists}} • {{To iso 639-2}} • {{To iso 639-3}} • {{Userbox-records}} • {{Bot steps}}
Audio files How to create a frequency list?Convert files formatsDenoise files with SoXRename and mass rename
Bots Help:BotsLinguaLibre:BotHelp:Log in to Lingua Libre with PywikibotLingua Libre Bot (gh) • OlafbotPamputtBotDragons Bot (gh)
MediaWiki MediaWiki: Help:Documentation opérationelle MediawikiHelp:Database structureHelp:CSSHelp:RenameHelp:OAuthLinguaLibre:User rights (rate limit) • Module:Lingua Libre record & {{Lingua Libre record}}JS scripts: MediaWiki:Common.jsLastAudios.jsSoundLibrary.jsItemsSugar.jsLexemeQueriesGenerator.js (pad) • Sparql2data.js (pad) • LanguagesGallery.js (pad) • Gadgets: Gadget-LinguaImporter.jsGadget-Demo.jsGadget-RecentNonAudio.jsLiLiZip.js
Queries Help:APIsHelp:SPARQLSPARQL (intermediate) (stub) • SPARQL for lexemes (stub) • SPARQL for maintenanceLingualibre:Wikidata (stub) • Help:SPARQL (HAL)
Reuses Help:Download datasetsHelp:Embed audio in HTML
Unstable & tests Help:SPARQL/test
Categories Category:Technical reports