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 6122389
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:53:37+00:00 2026-05-23T15:53:37+00:00

After terminating an ffmpeg subprocess, the terminal gets messed up – typed characters are

  • 0

After terminating an ffmpeg subprocess, the terminal gets messed up – typed characters are invisible! The input still works in that commands can be executed, but keyboard input is not echoed to the terminal.

Issuing shell command reset puts everything back to normal (or !reset from within ipython), so a workaround the issue is calling os.system('reset') inside the script.

Other things I’ve tried: import curses; curses.initscr() before spawning the subprocess and curses.endwin() after termination, which worked somewhat but broke other stuff. Another possibly related issue is that after spawning the child process, the interactive terminal becomes laggy and sometimes fails to capture typed characters.

The code to spawn the process looks like:

with open('/tmp/stdout.log', 'w') as o:
    with open('/tmp/stderr.log', 'w') as e:
        proc = subprocess.Popen([args], stdout=o, stderr=e)

And later to stop it:

proc.terminate()
proc.communicate()

What could be going wrong here?

  • 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-05-23T15:53:37+00:00Added an answer on May 23, 2026 at 3:53 pm

    Change the script so that proc.terminate() is not used. You can stop an ffmpeg subprocess more politely with

      proc.send_signal(signal.SIGINT)
      proc.wait()
    

    This allows ffmpeg the chance to write whatever escape sequences it needs to restore the terminal.


    edit: discovered later- another tip to make ffmpeg behave better with Popen is to provide it a subprocess.PIPE or open(os.devnull) in the stdin handle. Otherwise, it seems to try to get input from the parent’s stdin which can cause weird terminal behaviour. A running ffmpeg process is listening for ‘?’ and ‘q’ input on stdin.

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

Sidebar

Related Questions

After being told by at least 10 people on SO that version control was
After hours of debugging, it appears to me that in FireFox, the innerHTML of
After I was convinced that labeled breaks/continues are a total nono over here ,
I'm gettin the followig error after converting JSON echo into a dictionary, * Terminating
I have a very painful slow script that gets lots of data from MySQL
I am creating a simple app that let's the user view movies after clicking
Thank you everybody so far for your input and advice! Additionally: After testing and
I insert new record to Project table and after that I restore DB and
i've got this error after parsing. * Terminating app due to uncaught exception 'NSInvalidArgumentException',
I'm trying to make my table view remember it's last position, so that after

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.