Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sometimes when recording videos, file size is 0kb (windows 10). #5702

Open
fzp-1120 opened this issue Dec 25, 2024 · 5 comments
Open

Sometimes when recording videos, file size is 0kb (windows 10). #5702

fzp-1120 opened this issue Dec 25, 2024 · 5 comments

Comments

@fzp-1120
Copy link

use subprocess by python, loop recording video with a 5-second interval in between,but some file size is 0kb. Has anyone meet this problem before?

file format: mkv

command:
start_record_command = f"scrcpy -s {device_id} --record={filepath} --record-format=mkv --time-limit={time_limit} --no-playback --no-window"

version: scrcpy 3.1

@rom1v
Copy link
Collaborator

rom1v commented Dec 25, 2024

If you do the same manually (not calling from pyrhon), does it work?

You must not kill the process, scrcpy must terminate gracefully.

@fzp-1120
Copy link
Author

If you do the same manually (not calling from pyrhon), does it work?

You must not kill the process, scrcpy must terminate gracefully.

I used --time-limited, and process automatically ends,but video file size is 0kb. I found it works normally when removing --no-window. but I don't want to see the window, how can I to kill the process?

@rom1v
Copy link
Collaborator

rom1v commented Dec 25, 2024

Questions:

  • do you have a log INFO: Recording complete to mkv file: …?
  • if you record to mp4 (not mkv) with scrcpy --record=file.mp4 --time-limit=30 (with a duration long enough so that the file is not empty), is the resulting file corrupted?

I used --time-limited, and process automatically ends,but video file size is 0kb. I found it works normally when removing --no-window. but I don't want to see the window, how can I to kill the process?

Even without starting it from python?

From a console, if I run:

scrcpy --record=file.mp4 --time-limit=1 --no-playback --no-window

The resulting file is not empty.

@rom1v
Copy link
Collaborator

rom1v commented Dec 25, 2024

This also works correctly for me (the resulting file is not empty):

#!/usr/bin/env python3

import subprocess

subprocess.run(["scrcpy", "--record=file.mp4", "--time-limit=1", "--no-playback", "--no-window"])

@fzp-1120
Copy link
Author

no such information:INFO: Recording complete to mkv file,but this command works,thanks!This problem might be subprocess.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants