FFMPeg 2 pass c#

zerosandones

I have been scouring through the web to try and find a good walkthrough of FFMPeg and it's nuances.

I have a working setup currently. It is a two pass encoding. If I use a cmd window and use the following args:

ffmpeg -i c:\temp\175663.lbl.mp4.mps -vcodec mpeg4 -b:v 1300k -s 640x360 -aspect 16:9 -pass 1 -r 29.970 -an -f rawvideo -y NUL && ffmpeg -i c:\temp\175663.lbl.mp4.mps -vcodec mpeg4 -b:v 1300k -s 640x360 -aspect 16:9 -pass 2 -r 29.970 -acodec libmp3lame -ab 128k -ar 48000 c:\temp\encoded\175663.NTP.mp4

I get a log file in the ffmpeg.exe directory. Which I believe to be a valid good log. I also get a valid good mp4 file. However, I have no idea whether the log file is actually used on pass2. If I run just the second pass (everything after the &&) in a cmd window all by itself. I get a valid mp4 file. Why is there no error? This makes me suspect that the original pass isn't being used at all for the second pass.

Secondly, how can I programmatically delete the log of pass1? Is there a naming convention that I can key into? Eventually this application will be running on multiple threads on the same/other machines. So I can't exactly just delete *.log from the ffmpeg folder. Is there a way to name the files as they are created?

Lastly, I do not seem to be able to start a new process in C# with the argument above. If I omit the ffmpeg (because the process is starting ffmpeg itself) I get an error on &&. I don't think it likes trying to do two passes. If I do one pass at a time, I do not get a log file to even try to use on the second pass.

Any info would be amazing. Thank you for your time in advance!

George Y.

First if you're asking about the proper cmdline switches for ffmpeg, then this is likely not a proper question for StackOverflow, and it belongs to SuperUser.

Second, yes the log is used during the second pass. The log's role is to keep the bitrate requirements in each frame, so the total bandwidth could be utilized better if you specify the target bitrate (which you did with -b:v); as a side note, if you're using constant quantizer (also called "constant quality") then it won't be used but with constant quantizer you won't need multiple pass encoding.

You should be able to start this cmdline as two processes, one after another, there should be no difference in the log file creating. If it is, make sure the current directory for your process is set properly.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related