stdout

getting mulitple images from a single stream piped from ffmpeg stdout

冷暖自知 提交于 2019-12-24 03:12:50
问题 I start a process to retrieve a few frames from a video file with ffmpeg, ffmpeg -i "<videofile>.mp4" -frames:v 10 -f image2pipe pipe:1 and pipe the images to stdout - var cmd = Process.Start(p); var stream = cmd.StandardOutput.BaseStream; var img = Image.FromStream(stream); Getting the first image this way works, but how do I get all of them? 回答1: OK this was gobspackingly easy, kind of embarrassed I asked here. I'll post the answer in case it will help anyone else. The first few bytes in

getting mulitple images from a single stream piped from ffmpeg stdout

纵饮孤独 提交于 2019-12-24 03:12:06
问题 I start a process to retrieve a few frames from a video file with ffmpeg, ffmpeg -i "<videofile>.mp4" -frames:v 10 -f image2pipe pipe:1 and pipe the images to stdout - var cmd = Process.Start(p); var stream = cmd.StandardOutput.BaseStream; var img = Image.FromStream(stream); Getting the first image this way works, but how do I get all of them? 回答1: OK this was gobspackingly easy, kind of embarrassed I asked here. I'll post the answer in case it will help anyone else. The first few bytes in

How do I print the stdout for unit test in Android?

混江龙づ霸主 提交于 2019-12-24 03:11:46
问题 I need a quick way to do a few tests and don't want to look at the Dalvik Debug Monitor. I just want to create a quick public static void main() and print some results to experiment with for debugging. I thought I could use the unit testing framework to get some results on the console stdout, but System.out.println() still goes to the log (as well as Log.d() ). So is there a way to print the the stdout when running a unit test? ant debug install test test: [echo] Running tests ... [exec]

G++ compiler: Segfault handling

╄→гoц情女王★ 提交于 2019-12-24 02:43:23
问题 I'm working on a project where I call a function which triggers a segfault. I fixed this, but during the process I noticed the following. When my code is of the format; main(){ ... std::cout << "Looking for segfault\n"; // this does not print buggyFunction(); // crashes in here ... } buggyFunction(){ ... thing_that_causes_segfault; ... } The line "Looking for segfault" doesn't print to STD, and the program crashes in buggyFunction. Fine, but when I add a cout line inside buggyFunction(); main

Append output of one command to the output of another in a single command

╄→尐↘猪︶ㄣ 提交于 2019-12-24 02:25:18
问题 Is there a way to append the stdout output of one command to another's and pipe the combined output to another command? I used to use the following approach(taking ack-grep as an example) # List all python, js files in different directories ack-grep -f --py apps/ > temp ack-grep -f --js -f media/js >> temp cat temp | xargs somecommand Is there a way to do this in a single command? 回答1: Just run the two ack-grep commands as a compound command; then pipe the results of the compund command. The

freopen not writing to the specified file

梦想与她 提交于 2019-12-24 02:16:56
问题 I am trying to redirect output of stdout and stderr using a file. I am using freopen and it creates the file in the correct directory but the file is blank. When I comment out the code to redirect the stdout and stderr - the output shows up on the console. Here is the code: freopen(stderrStr.c_str(), "a+", stderr); //where stderrStr and stdoutStr are the path/file name freopen(stdoutStr.c_str(), "a+", stdout); fclose(stdout); fclose(stderr); I have placed a printf("I WORK") in main and

StringIO portability between python2 and python3 when capturing stdout

旧巷老猫 提交于 2019-12-24 00:57:51
问题 I have written a python package which I have managed to make fully compatible with both python 2.7 and python 3.4, with one exception that is stumping me so far. The package includes a command line script, and in my unit tests I use this code to run the script's main routine while overriding sys.argv to pass command line arguments for argparse, and capturing the script's stdout for comparison: @contextlib.contextmanager def runmain(mainfunction, arglist): """Run mainfunction with arglist in

I can't sys.stdout.seek

淺唱寂寞╮ 提交于 2019-12-24 00:42:31
问题 From what I know, sys.stdout is a file that represents the stdout of a terminal. However, when I try to use sys.stdout.seek , whatever parameters I give it, it throws an error: IOError: [Errno 29] Illegal seek What's going on? Is it the fact that I'm using the TTY itself and not a virtual terminal like xterm? How can I resolve this? 回答1: When stdout is a TTY it's a character device and it's not seekable, you cannot seek in a TTY. Same for tell , it's not implemented: >>> sys.stdout.tell()

C++ Locking stream operators with mutex

耗尽温柔 提交于 2019-12-24 00:26:00
问题 I need to lock stdout in my logging application to prevent string interleaving in multi-thread applications logging to stdout. Can't figure out how to use move constructor or std::move or sth else to move unique_lock to another object. I created objects for setting configs and encapsulation and figured out how to lock stdout with static std::mutex to lock from these objects (called shards). Something like this works for me: l->log(1, "Test message 1"); While that is fine and could be

perl how can I append STDOUT of list form system call of perl script to a file

萝らか妹 提交于 2019-12-23 23:09:55
问题 My bosswrap.pl will generate arbitrary arrays containing whitespace in the elements. It repeatedly sends the array by a system call to wrapped.pl , which creates STDOUT based on the array. Subsequently, bosswrap.pl must append the STDOUT of wrapped.pl to a file which bosswrap.pl controls. That is where I am stuck. First wrapped.pl : #!/usr/bin/perl use strict; use warnings; print "inside $0\n"; my $countarrayelements=0; for my $item ( @ARGV ) { $countarrayelements++; print "