Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Convert .MTS files
#6
Another question if I may please.

The above ffmpeg command was successful in converting 00003.mts into filename3.mp4. I am now trying to work thsi into my python script.

Here's my script so far
import subprocess
import os, sys
path = "C:\\upload"
path2= "C:\\upload\completed"
dirs = os.listdir( path )
Count=0
d = []

for file in dirs:
   file_path = os.path.join(path, file)
   file_path2 = os.path.join(path2, file)
   print (file_path)
   os.system('ffmpeg -i file_path -r 30 -s 1280x720 -c:v libx264 -crf 23 -ac 1 file_path2')
   Count = Count+1 
and here's the output
Output:
>>> = RESTART: C:/Users/Peter/AppData/Local/Programs/Python/Python36-32/test2.py = C:\upload\00030.MTS C:\upload\00031.MTS C:\upload\00032.MTS C:\upload\00033.MTS C:\upload\completed >>>
The object of my script is to cycle through all the files in C:\upload, process each one and put the output in c:\upload\completed. As you can see I am running into a couple of problems. First my os.system() commands don't seem to be resulting in any processing. Nothing is appearing in the completed folder. Next my loop is capturing the text  'completed as as file which is not what I want. As you can see I have 4 files in the C:\upload directory. I just want to process these and finish. I would be grateful if you could point out what I am doing wrong. I did try to use the subprocess.run command but this did not work either.

Hoping someone can help.

cheers Peter
Reply


Messages In This Thread
Convert .MTS files - by pberrett - Apr-14-2017, 11:06 AM
RE: Convert .MTS files - by sparkz_alot - Apr-14-2017, 01:01 PM
RE: Convert .MTS files - by snippsat - Apr-14-2017, 07:14 PM
RE: Convert .MTS files - by pberrett - Apr-15-2017, 05:55 AM
RE: Convert .MTS files - by pberrett - Apr-15-2017, 07:40 AM
RE: Convert .MTS files - by pberrett - Apr-15-2017, 11:53 AM
RE: Convert .MTS files - by zivoni - Apr-15-2017, 12:19 PM
RE: Convert .MTS files - by pberrett - Apr-15-2017, 01:56 PM
RE: Convert .MTS files - by snippsat - Apr-15-2017, 02:16 PM
RE: Convert .MTS files - by pberrett - Apr-15-2017, 02:38 PM
RE: Convert .MTS files - by snippsat - Apr-15-2017, 02:44 PM
RE: Convert .MTS files - by pberrett - Apr-15-2017, 02:50 PM
RE: Convert .MTS files - by snippsat - Apr-15-2017, 03:40 PM
RE: Convert .MTS files - by snippsat - Apr-15-2017, 07:05 PM
RE: Convert .MTS files - by zivoni - Apr-15-2017, 07:50 PM
RE: Convert .MTS files - by snippsat - Apr-15-2017, 08:12 PM
RE: Convert .MTS files - by pberrett - Apr-16-2017, 03:54 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  python convert multiple files to multiple lists MCL169 6 1,707 Nov-25-2023, 05:31 AM
Last Post: Iqratech
  Separate text files and convert into csv marfer 6 3,004 Dec-10-2021, 12:09 PM
Last Post: marfer
  Convert a PDF files to HTML files Underground 4 12,444 Oct-25-2020, 09:12 PM
Last Post: Larz60+
  convert old excel files(xls) to xlsm zarize 1 3,445 Jul-14-2020, 02:12 PM
Last Post: DeaD_EyE
  How to convert python files from 32 bits tto 64 bits sylas 2 5,170 Oct-29-2017, 03:51 AM
Last Post: Larz60+
  Convert grib files to text files tuxman 6 9,422 Sep-15-2017, 03:26 PM
Last Post: nilamo

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020