Apr-15-2017, 05:55 AM
Thanks all. I decided to use FFMPEG and altered the code above to the following. First though I installed the Zerano build of FFMPEG.
Here's my code
import subprocess
import os
path = 'C:/test'
for file in os.scandir('.'):
if file.name.endswith('MTS'):
#print(file.name)
file_path = os.path.join(path, file.name)
subprocess.run(['ffmpeg', '-i', f'{file_path}', '-c:v', 'copy', f'{os.path.splitext(file.name)[0]}.mp4'])
In the subdirectory c:/test I have a small file called 00020.MTS which is a brief video. When I run the above script I get the following response before being returned to Idle.
>>>
== RESTART: C:/Users/Peter/AppData/Local/Programs/Python/Python36-32/t1.py ==
>>>
I then uncommented the command
#print(file.name)
and ran the script again but got the same result. The If.. command did not seem to be being triggered, In other words the python program was not seeing the . MTS file.
Why is this so? How can this be fixed.
That aside I must say I like the efficient way that files can be converted using FFMPEG.
cheers Peter
Here's my code
import subprocess
import os
path = 'C:/test'
for file in os.scandir('.'):
if file.name.endswith('MTS'):
#print(file.name)
file_path = os.path.join(path, file.name)
subprocess.run(['ffmpeg', '-i', f'{file_path}', '-c:v', 'copy', f'{os.path.splitext(file.name)[0]}.mp4'])
In the subdirectory c:/test I have a small file called 00020.MTS which is a brief video. When I run the above script I get the following response before being returned to Idle.
>>>
== RESTART: C:/Users/Peter/AppData/Local/Programs/Python/Python36-32/t1.py ==
>>>
I then uncommented the command
#print(file.name)
and ran the script again but got the same result. The If.. command did not seem to be being triggered, In other words the python program was not seeing the . MTS file.
Why is this so? How can this be fixed.
That aside I must say I like the efficient way that files can be converted using FFMPEG.
cheers Peter