Problems raised by C # multi-process

Source: Internet
Author: User

Recently developing a program that uses FFmpeg to complete the video recording of the camera, which mentions the need to start and end the recording separately when triggering the start and end signs, and just start planning to use the FFmpeg directly to complete the function, but when the development process found that can not fully implement the function, Because FFmpeg can record a specified length of video, but this project in the beginning of the recording is not known the length of the specified, so think only in the process of starting ffmpeg to make a fuss.

Sure enough, the way to end the process can actually complete the function, the specific idea is as follows, in the receiving end of the flag, the process is killed directly, do not use the dispose,close, etc., will be error, direct a kill can reach your request, Originally thought has completed the function, but the careful test found that ffmpeg recorded video length of only 10 seconds or so length, will not record longer length, this look caught in the pit, found an interesting phenomenon, once the main program is closed, Ffmpeg.exe will continue to execute, it is obvious: The process of recording the video was blocked by the parent process , but it was not known what the cause of the blockage was, and two processes did not have shared resources.

This problem bothered me one night, the next day to continue debugging will still have a corresponding problem, found on the Internet related Java blocking posts, but all with I/O interaction, there is a mention need to set up the process (object). Redirectstandardinput, with the Redirectstandarderror property of true, reflects the need to set these two properties to interact with the command line, but ffmpeg this process does not need to interact with the command line should not need to set these two properties, Comment out the two attributes, test, solve the problem.

Problems raised by C # multi-process

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.