Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8587281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:31:55+00:00 2026-06-11T22:31:55+00:00

I’m using GNU/Linux and python 2.7.3, I’m new on it. I’m trying to execute

  • 0

I’m using GNU/Linux and python 2.7.3, I’m new on it. I’m trying to execute a long installed system process like ffmpeg using the Popen() command to avoid blocking the main python process. I can’t make it work.

My first attempt was to use threads, but it is a bit complicated, because the graphical interface doesn’t work properly (and I suppose there has to be a better way)

Then I tried fork, but it is like killing flies with tanks.

Now I’m trying to use Popen, I saw a lot of references to its use in the internet, but I’m not running it properly I think. Maybe I’m misunderstanding the examples.

I’ve tried:

##command is ffmpeg like that works ok
p = subprocess.Popen(command, shell=True)    

I’ve tried also:

p = subprocess.Popen(command,stdin=PIPE, shell=True)

Usually I get an error or a sequentcial behavior, the command ends and then the main program resumes. What am I missing?

The command part:

    global vidSource
    global srtSource
    global done
    size = "3"

    font = "/usr/share/fonts/truetype/freefont/FreeSerif.ttf"
    command = 'mencoder ' + '"' + vidSource + '"' + " -oac copy -ovc lavc -lavdopts threads=2 -sub " + "'" + srtSource + "'" + " -subcp -utf8 -font "+ '"'+ font+ '"' + " -subfont-text-scale " + size + " -o " + '"' + vidSource + '2'+'"' 
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T22:31:56+00:00Added an answer on June 11, 2026 at 10:31 pm

    You should be on a good track. Just use

    p = subprocess.Popen(command)
    

    You can check whether the process has ended with a p.poll, as described in the documentation

    Note that using shell=True is not recommended (for security reasons), so you should try not to use it unless you have a very good reason.

    As described in the documentation, your command must be a list of arguments. If you build a long string, you should use shlex.split(command) to transform it into a string while preserving the " and forth (of course, you need a import shlex in your module).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm new to using the Perl treebuilder module for HTML parsing and can't figure
I have a string like this: La Torre Eiffel paragonata all’Everest What PHP function
I am trying to render a haml file in a javascript response like so:
I have thousands of HTML files to process using Groovy/Java and I need to
That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I would like to count the length of a string with PHP. The string
For some reason, after submitting a string like this Jack’s Spindle from a text
I am trying to understand how to use SyndicationItem to display feed which is
I am reading a book about Javascript and jQuery and using one of the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.