Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can i parse strings as the inputs to subprocess.Popen?
    primarykey
    data
    text
    <p>Here I tried to cut first and second 30sec long video file from "path/connect.flv" to the files output1.flv and output2.flv. It works. I able to concatenate these two files to form a new file "final.flv" of 60sec long. So this works and i am getting the outputs output1.flv [30sec], output2.flv[30sec] and final.flv[1min]. </p> <p>Here is the python code:</p> <pre><code>import subprocess ffmpeg_command1 = ["ffmpeg", "-i", "/home/xincoz/test/connect.flv", "-acodec", "copy", "-ss", "00:00:00", "-t", "00:00:30", "/home/xincoz/test/output1.flv"] ffmpeg_command2 = ["ffmpeg", "-i", "/home/xincoz/test/connect.flv", "-acodec", "copy", "-ss", "00:00:30", "-t", "00:00:30", "/home/xincoz/test/output2.flv"] ffmpeg_command3 = ["mencoder", "-forceidx", "-ovc", "copy", "-oac", "pcm", "-o", "/home/xincoz/test/final.flv", "/home/xincoz/test/output1.flv", "/home/xincoz/test/output2.flv"] subprocess.call(ffmpeg_command1) subprocess.call(ffmpeg_command2) subprocess.Popen(ffmpeg_command3) </code></pre> <p>But what i really want is to concatenate two strings out1 and out2 and concatinate these two to a file instead of concatenating "/home/xincoz/test/output1.flv" and "/home/xincoz/test/output2.flv". So how can i parse string out1 and out2 as the inputs to mencoder ? Please edit my code to achieve the result.</p> <pre><code>import subprocess,os ffmpeg_command = ["ffmpeg", "-i", "/home/xincoz/test/connect.flv", "-acodec", "copy", "-ss", "00:00:00", "-t", "00:00:30","-f", "flv", "pipe:1"] p = subprocess.Popen(ffmpeg_command,stdout=subprocess.PIPE) out1, err = p.communicate() ffmpeg_command1 = ["ffmpeg", "-i", "/home/xincoz/test/connect.flv", "-acodec", "copy", "-ss", "00:00:30", "-t", "00:00:30","-f", "flv", "pipe:1"] p1 = subprocess.Popen(ffmpeg_command1,stdout=subprocess.PIPE) out2, err1 = p1.communicate() ffmpeg_command2 = ["mencoder", "-forceidx", "-ovc", "copy", "-oac", "pcm", "-o", "/home/xincoz/test/final.flv", out1, out2 ] p2=subprocess.Popen(ffmpeg_command2) </code></pre> <p>Please help me. Thanks a lot in advance.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload