Python2 find the corresponding recording clips according to the index table splicing recording

Source: Internet
Author: User

#encoding: Utf-8?
Import CSV
Import OS
Dataconvert = []
Datastitch? = []
Voicefrom = "/home/mylinux/dengcong/"
Voicetar =? "/home/mylinux/dengcong/tar/"
Os.system ("Mkdir-p" +voicetar)
Csvstitch = open ("/home/mylinux/dengcong/stitch.csv", "R")
Readerstitch = Csv.reader (Csvstitch)
Csvconvert = open ("/home/mylinux/dengcong/convert.csv", "R")
Readerconvert = Csv.reader (Csvconvert)
For item1 in Readerconvert:
??? Dataconvert.append (ITEM1)
For item2 in Readerstitch:
??? Datastitch.append (ITEM2)
def onepis (tmpid):
??? Dataarr = []
??? For line in Datastitch:
??????? i = CMP (Tmpid,line[0].strip ())
??????? #print (Tmpid,line[0].strip (), i)
??????? If i = = 0:
??????????? Dataarr.append (line)
??? Dataarr.sort (Key=lambda x:x[2])
??? return Dataarr;
For item in Dataconvert:
??? Orderarr = []
??? Tmpstr = item[2]+ "0" +item[3]
??? Tmpstr = Tmpstr.strip ()
??? Orderarr.append (Tmpstr.strip ())
??? #print (TMPSTR)
??? xxx = Onepis (TMPSTR)
??? For line in XXX:
??????? Orderarr.append (Line[1].strip ())
??? #print (Orderarr)
??? Ffmstr = "FFmpeg"
??? For one in Orderarr:
??????? Ffmstr = Ffmstr + "-i" + voicefrom + one + ". wav"
??? Ffmstr = ffmstr + "-filter_complex"
??? Count = 0
??? While Count<len (Orderarr):
??????? Ffmstr = Ffmstr + "[" + str (count) + ": 0]"
??????? Count = Count + 1
??? Ffmstr = ffmstr + "concat=n=" + str (len (orderarr)) + ": v=0:a=1 '" + Voicetar +? Tmpstr + "Done.wav"
??? #print (FFMSTR)
??? Os.system (FFMSTR)
Csvstitch.close ()
Csvconvert.close ()

Python2 find the corresponding recording clips according to the index table splicing recording

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.