using ffmpeg command line with python's subprocess module

R

rusi

On 06/12/2013 15:34, Steven D'Aprano wrote:

(if I remember correctly) I think Mark also



You do, and here it is https://wiki.python.org/moin/GoogleGroupsPython

That link needs updating.

Even if my almost-automatic correction methods are not considered
kosher for some reason or other, the thing that needs to go in there
is that GG has TWO problems

1. Blank lines
2. Long lines

That link only describes 1.

Roy's yesterday's post in "Packaging a proprietary python library"
says:
I, and Rusi, know enough, and take the effort, to overcome its
shortcomings doesn't change that.

But in fact his post takes care of 1 not 2.

In all fairness I did not know that 2 is a problem until rurpy pointed
it out recently and was not correcting it. In fact, I'd take the
trouble to make the lines long assuming that clients were intelligent
enough to fit it properly into whatever was the current window!!!

So someone please update that page!
 
M

Mark Lawrence

That link needs updating.

Even if my almost-automatic correction methods are not considered
kosher for some reason or other, the thing that needs to go in there
is that GG has TWO problems

1. Blank lines
2. Long lines

That link only describes 1.

Roy's yesterday's post in "Packaging a proprietary python library"
says:


But in fact his post takes care of 1 not 2.

In all fairness I did not know that 2 is a problem until rurpy pointed
it out recently and was not correcting it. In fact, I'd take the
trouble to make the lines long assuming that clients were intelligent
enough to fit it properly into whatever was the current window!!!

So someone please update that page!

This is a community so why don't you?
 
M

MRAB

Mark is writing in fake old-English style, the way people think English
was spoken a thousand years ago. I don't know why he did that. Perhaps he
thought it was amusing.
[snip]
You're exaggerating. It's more like 500 years ago. :)
 
R

rusi

yes ,I am a native Chinese speaker.I always post question by Google
Group not through email ,is there something wrong with it ? your
english is a little strange to me .
Mark is writing in fake old-English style, the way people think English
was spoken a thousand years ago. I don't know why he did that. Perhaps he
thought it was amusing. [snip]

You're exaggerating. It's more like 500 years ago. :)

I was going to say the same until I noticed the "the way people think English
was spoken..."

That makes it unarguable -- surely there are some people who (wrongly) think so?
 
I

iMath

在 2013å¹´12月6日星期五UTC+8下åˆ10æ—¶59分43秒,Chris Angelico写é“:
fp=tempfile.NamedTemporaryFile(delete=False)
fp.write(("file '"+fileName1+"'\n").encode('utf-8'))
fp.write(("file '"+fileName2+"'\n").encode('utf-8'))
subprocess.call(['ffmpeg', '-f', 'concat','-i',fp.name, '-c', 'copy', fileName])
fp.close()



You need to close the file before getting the other process to use it.

Otherwise, it may not be able to open the file at all, and even if it

can, you might find that not all the data has been written.



But congrats! You have successfully found the points I was directing

you to. Yes, I was hinting that you need NamedTemporaryFile, the .name

attribute, and delete=False. Good job!



ChrisA

we don't have permission to use the temporary file while it has not been closed,but when the file is closed , it will be destroyed by default(delete=True),but once we set delete=False,then we couldn't depend on the convenience of letting the temporary file automatically delete itself after it has been used(then we have to delete it later by os.remove()) ,thus there is nearly no convenience in creating a temporary file or a persistent one when using NamedTemporaryFile.

I think this is a design flaw and should be improved like this :when delete=True,the file should be removed upon destruction of the object or on function return or on garbage collected,only when delete=False,the file can remain on the disk .
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,083
Messages
2,570,591
Members
47,212
Latest member
RobynWiley

Latest Threads

Top