Overclock.net - Overclocking.net
     
 
Home Gallery Reviews Blogs Register Today's Posts Mark Forums Read Members List


Go Back   Overclock.net - Overclocking.net > Software, Programming and Coding > Coding and Programming

Reply
 
LinkBack Thread Tools
Old 4 Weeks Ago   #1 (permalink)
4.0ghz
 
Coma's Avatar
 
intel nvidia

Join Date: Jun 2007
Posts: 7,479

Rep: 455 Coma is a proven memberComa is a proven memberComa is a proven memberComa is a proven memberComa is a proven member
Unique Rep: 328
Trader Rating: 0
Default C# Output piping

So... C# lacks a simple system() call. I tried getting it to work using their anal implementation, but can't. ffmpeg starts, but does nothing. If someone can tell me what's wrong, I'll be grateful.

Perl:
Code:
      system("ffmpeg -i \"".$eachFile."\" -vcodec rawvideo -pix_fmt yuv420p -f rawvideo - 2>NUL | x264-nalhrd --quiet --crf 24 --interlaced --nal-hrd --bff --preset fast -o \"".$dist.$filename.".mp4\" --fps 30000/1001 - 720x486");
C#:
Code:
                Process ffmpeg = new Process();
                ProcessStartInfo ffmpegStartInfo = new ProcessStartInfo();
                ffmpegStartInfo.FileName = "ffmpeg.exe";
                ffmpegStartInfo.RedirectStandardOutput = true;
                ffmpegStartInfo.UseShellExecute = false;
                ffmpegStartInfo.Arguments = "-i \"" + file.FullName + "\" -vcodec rawvideo -pix_fmt yuv420p -f rawvideo -";
                Process x264 = new Process();
                ProcessStartInfo x264StartInfo = new ProcessStartInfo();
                x264StartInfo.Arguments = "--quiet --crf 24 --interlaced --nal-hrd --bff --preset fast -o \"" + global.dist + file.Name.Substring(0, file.Name.Length - (global.ext.Length + 1)) + ".mp4\" --fps 30000/1001 - 720x486";
                x264StartInfo.RedirectStandardInput = true;
                x264StartInfo.UseShellExecute = false;
                x264StartInfo.FileName = "x264-nalhrd.exe";
                x264.StartInfo = x264StartInfo;
                ffmpeg.StartInfo = ffmpegStartInfo;
                ffmpeg.Start();
                x264.Start();
                x264.WaitForExit();
                ffmpeg.WaitForExit();
__________________
When asking for help: state the goal, not the step.

System: Akiyama Mio
CPU
E6420 @ stock, 0.98v
Motherboard
Asus P5N-E SLI
Memory
2x1GB OCZ Platinum @ 800MHz 4-4-4-12 1T, 1.9v
Graphics Card
BFG 8800GT 512MB
Hard Drive
WD 250GB, 320GB SATA/3, 16MB Cache
Power Supply
Corsair 520HX
Case
NZXT Apollo Black
CPU cooling
Stock
OS
Ubuntu 9.04 x86 & XP x86
Monitor
Asus VW222U
Coma is online now Overclocked Account   Reply With Quote
Old 4 Weeks Ago   #2 (permalink)
PC Gamer
 
chemicalfan's Avatar
 
intel ati

Join Date: May 2008
Location: Portsmouth, UK
Posts: 1,377
Blog Entries: 3

Rep: 116 chemicalfan is acknowledged by manychemicalfan is acknowledged by many
Unique Rep: 90
Trader Rating: 0
Default

Lol - what a scripting language can do in 1 line, takes C# 18 lines!!

Sorry, I know that didn't help, but it reminds me why so-called scripting languages are awesome
__________________
Intel Processor Finder - essential knowledge for OC'ers
OCCT - essential tool for OC'ers
Quote:
Originally Posted by Inuyasha1771
I hate it when they are like " LET'S WATCH A MOVIE >=3" and you're like "No, it's 6 PM, I just got off work, I need to overclock." and they can't relate. Give me a girl who overclocks, and I'll give you a miracle.

System: Black 'n' blue II
CPU
Core i7 860
Motherboard
MSI P55-GD60
Memory
4GB G.Skill Ripjaw
Graphics Card
Xpertvision Radeon HD4850
Hard Drive
150Gb Velociraptor & 250Gb Samsung
Sound Card
ESI Maya USB
Power Supply
Thermaltake Purepower RX 550
Case
Galaxy II
CPU cooling
Noctua NH-U12P SE2
GPU cooling
Stock
OS
Vista Home Premium x64
Monitor
Hyundai BlueH H224W 22" LCD
chemicalfan is online now   Reply With Quote
Old 4 Weeks Ago   #3 (permalink)
4.0ghz
 
Coma's Avatar
 
intel nvidia

Join Date: Jun 2007
Posts: 7,479

Rep: 455 Coma is a proven memberComa is a proven memberComa is a proven memberComa is a proven memberComa is a proven member
Unique Rep: 328
Trader Rating: 0
Default

It's really only C# which is this retarded. Java, which is sort of regarded as C#'s twin, can do it in a single line, too.

Turns out you can actually starts cmd.exe without a window and feed it commands... talk about ass backwards.

Also, when I finally got the pipes working in the implementation above (I hadn't captured them) -- it turned out that C# is doing some processing on the input and output before giving it to the process (why the hell?)... which makes for nasty things like this:
__________________
When asking for help: state the goal, not the step.

System: Akiyama Mio
CPU
E6420 @ stock, 0.98v
Motherboard
Asus P5N-E SLI
Memory
2x1GB OCZ Platinum @ 800MHz 4-4-4-12 1T, 1.9v
Graphics Card
BFG 8800GT 512MB
Hard Drive
WD 250GB, 320GB SATA/3, 16MB Cache
Power Supply
Corsair 520HX
Case
NZXT Apollo Black
CPU cooling
Stock
OS
Ubuntu 9.04 x86 & XP x86
Monitor
Asus VW222U
Coma is online now Overclocked Account   Reply With Quote
Old 4 Weeks Ago   #4 (permalink)
Security Sleuth
 
Pooping^fish's Avatar
 
intel nvidia

Join Date: Jul 2007
Location: egypt
Posts: 1,267

Rep: 67 Pooping^fish is acknowledged by some
Unique Rep: 62
Trader Rating: 3
Default

You are piping it after all. Funny things will happen.

Try it correctly with a CreateProcess or similar.
__________________
Quote:
"O, hai! Want som pRon? Dwnlod ths kodk frst. Its teh bst pRonz ever, we prmis." -GibbyGano
Proud Member of the Linux Gaming Community
I am your friend.

System: ragequit
CPU
Q9550 4ghz @ 1.25v
Motherboard
Asus Max 2 formula
Memory
OCZ LV blade 1:1 950mhz
Graphics Card
8800gtx 610/1ghz
Hard Drive
7200.10 250gb
Sound Card
X-FI Extreme Music
Power Supply
750w Toughpower
Case
Lian li pc-65
CPU cooling
TRUE
GPU cooling
stock
OS
leetlinucks
Monitor
24" Westy
Pooping^fish is offline   Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools



All times are GMT -5. The time now is 10:51 AM.


Overclock.net is a Carbon Neutral Site Creative Commons License

Terms of Service / Forum Rules | Privacy Policy | DMCA Info | Advertising | Become an Official Vendor
Copyright © 2009 Shogun Interactive Development. Most rights reserved.
Page generated in 0.11737 seconds with 8 queries