Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8319963
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T22:29:39+00:00 2026-06-08T22:29:39+00:00

I have tried the following: $ffmpeg = /path/to/ffmpeg; $source = /path/to/video/source.mp4; $dest = /path/to/video/dest.mp4;

  • 0

I have tried the following:

$ffmpeg = "/path/to/ffmpeg";
$source = "/path/to/video/source.mp4";
$dest = "/path/to/video/dest.mp4";
$format = "%s > %s 2>&1 & echo $! >> %s";
$a_rate = "44100";
$a_bitrate = "96k";
$v_bitrate = "3000k";
$resolution = "1280x720";
$outputfile = "/path/to/output.txt";
$pidfile = "/path/to/pid.txt";

exec(sprintf($format, $ffmpeg . " -i " . $source . " -vcodec libx264 -s " . $resolution . " -b " . $v_bitrate . " -pass 1 /dev/null && \ " . $ffmpeg . " -i " . $source . " -acodec libfaac -ar " . $a_rate . " -ab " . $a_bitrate . " -vcodec libx264 -s " . $resolution . " -b " . $v_bitrate . " -pass 2 " . $dest, $outputfile, $pidfile));

Everything works perfectly if I do a single pass, but trying to do two passes like that doesn’t work. What is the proper way to do it?

Update:

exec(sprintf($format, $ffmpeg . " -i " . $source . " -pass 1 -vcodec libx264 -s " . $resolution . " -b " . $v_bitrate . " -passlogfile " . $pass . " -f rawvideo -y /dev/null", $outputfile, $pidfile));
exec(sprintf($format, $ffmpeg . " -y -i " . $source . " -pass 2 -acodec libfaac -ar " . $a_rate . " -ab " . $a_bitrate . " -vcodec libx264 -s " . $resolution . " -b " . $v_bitrate . " -passlogfile " . $pass . " " . $dest, $outputfile, $pidfile));
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T22:29:41+00:00Added an answer on June 8, 2026 at 10:29 pm

    The issue was that putting the ffmpeg commands in the background with $format = "%s > %s 2>&1 & echo $! >> %s"; caused them both to be run at the same time and at that time there is no log file finished for the second pass to use. Backgrounding works fine with single pass because it has no dependencies, but I suppose a more involved solution is required to background two pass conversions. I am planning on using a queuing system.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have tried to compile ffmpeg with the new flascc compiler with the following
I have tried following queries to get my facebook fan page insights data SELECT
I have tried the following <input type=file name=upload multiple=multiple value=MyText> However the text on
I have tried the following MySQL update but it only sets the first field
I have tried the following program for writing the contents into Spreadsheet. I downloaded
I have tried the following: <%= image_tag '...path_to_img', :filter => alpha(opacity=50) %> But it
I have tried the following code but has no effect: Imports system.Runtime.InteropServices <DllImport(UxTheme.DLL, BestFitMapping:=False,
I have tried the following code: $('a.buildMenu').click(function (event) { // Prevent normal behaviour event.preventDefault();
I have tried the following but it seems the folder gets created on the
I have no idea why this wont work but I have tried the following:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.