Converting C Language Pipes

Just starting out? Need help? Post your questions and find answers here.
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Converting C Language Pipes

Post by chris319 »

I'm having trouble getting this C code converted and running in PB. It uses ffmpeg to read and write video frames. I can get the "read" part to work but I'm having trouble with the "write" part:

Code: Select all


FILE *pipeout = popen("ffmpeg -y -f rawvideo -vcodec rawvideo -pix_fmt rgb24 -s 1280x720 -r 25 -i - -f mp4 -q:v 5 -an -vcodec mpeg4 output.mp4", "w");

fwrite(frame, 1, H*W*3, pipeout);

I'm not sure how to handle the "w" at the end of the above line.

This is what I have so far in PB:

Code: Select all

pipeout$ = "  -y -f rawvideo -vcodec rawvideo -pix_fmt rgb24 -s 1280x720 -r 25 -i - -f mp4 -q:v 5 -an -vcodec mpeg4 output.mp4" + "w"

writeFrame = RunProgram("ffmpeg.exe", pipeOut$, "", #PB_Program_Open | #PB_Program_Write)

User avatar
mk-soft
Always Here
Always Here
Posts: 5338
Joined: Fri May 12, 2006 6:51 pm
Location: Germany

Re: Converting C Language Pipes

Post by mk-soft »

The last parameter is the mode of "popen"...

Link: http://pubs.opengroup.org/onlinepubs/00 ... popen.html

You can remove it.
My Projects ThreadToGUI / OOP-BaseClass / EventDesigner V3
PB v3.30 / v5.75 - OS Mac Mini OSX 10.xx - VM Window Pro / Linux Ubuntu
Downloads on my Webspace / OneDrive
chris319
Enthusiast
Enthusiast
Posts: 782
Joined: Mon Oct 24, 2005 1:05 pm

Re: Converting C Language Pipes

Post by chris319 »

I think the "w" is equivalent to the #PB_Program_Write flag in PB's RunProgram().
Post Reply