-
Notifications
You must be signed in to change notification settings - Fork 873
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
Memory file -> numpy -> memory file #156
Comments
Because you're reading and writing individual pipe file descriptors with a single python process, you're encountering a deadlock: The The reason it's a problem in this example but fine in the tensorflow example is that each of the ffmpeg processes in the tensorflow example only uses one pipe, whereas This is a common issue when working with blocking pipes, regardless of choice of language. Here are a few options I can think of off the top of my head: Option 1: Use threads (or python multiprocessing, gevent, etc) so that one thread is responsible for pumping data into process1, and another thread that's responsible for pumping data out of process1 and into process2. Both threads must be okay with being blocked. Option 2: Don't use a stdin pipe for process1. If you don't need to feed data to process1 from the same python process/thread that's doing the in-memory numpy processing and can avoid doing so, then it gets a lot simpler because you avoid this deadlock scenario. Option 3: Use non-blocking IO. Basically the Option 4: Run only one ffmpeg process at a time and use Some related, potentially useful search terms / research topics:
|
FYI, the |
Thanks for your kind suggestion! Q. Mismatching of number of frames between in/out.My test video has total 2793 frames but output video has 1396 frames. get information from video memoryFirst of all I modified probe to read video information from video byte.
process for encode and decodeMy process for ffmpeg is like below.
My Feeder processBelow two things are Process for feeding and numpy process.
Futhermore questionMy final goal is receive video data in memory is it need one more process for store? Anyway I really appreciate your advice and it makes me to understand python and ffmpeg. |
Sorry The frame rate was cause of my mistake. |
I used these commands. However, I get some errors.
How to solve these problems? |
Thanks for good library for us.
As mentioned in title I want to process video in raw byte to numpy
then encode it into raw byte video.
I succeed to read byte to mp4 with below comment.
#49 (comment)
It's okay for don't process anything.
But I want to process like your tensorflow stream example
So I tried with two process but it's doesn't work and process.
Below test is for video(byte) => numpy => video(file)
I think first problem is stdin. Above reading raw video byte use communicate method for stdin.
But below case it's not suit method cause need to process by each frame.
Do you have any idea for this?
Thanks for reading.
The text was updated successfully, but these errors were encountered: