VideoHelp Forum
+ Reply to Thread
Results 1 to 8 of 8
Thread
  1. Hello , i am trying to encode my videos to 3 different resolution in Parallel , i can copy the source for 3 times and then encode each of them with staxrip and i am doing it now , when i asked it from google i realized that i can use FFmpeg (See) but i prefer two pass bcz i care about the size and i couldnt use it with two pass and it didnt work

    please help me how can i use ffmpeg multiple output in two pass encoding - 1 source to 3 different output in 1080p - 720p - 480p , thanks
    Quote Quote  
  2. What do you mean by "it didn't work"? Always post the complete command you tried as well as the complete log.

    In principle it shouldn't be difficult. Just set a different stats file (-passlogfile) for each output. For some encoders it may even be viable to create only one stats file in the first pass and then re-use it for all resolutions.


    P.S.: What is the reason you are trying to use multiple outputs simultaneously instead of running one after another? Is the CPU not utilized enough? Heavy filtering/decoding? Often decoding time is negligible compared to encoding time.
    Quote Quote  
  3. Originally Posted by sneaker View Post
    What do you mean by "it didn't work"? Always post the complete command you tried as well as the complete log.

    In principle it shouldn't be difficult. Just set a different stats file (-passlogfile) for each output. For some encoders it may even be viable to create only one stats file in the first pass and then re-use it for all resolutions.


    P.S.: What is the reason you are trying to use multiple outputs simultaneously instead of running one after another? Is the CPU not utilized enough? Heavy filtering/decoding? Often decoding time is negligible compared to encoding time.
    i have a powerfull cpu that i can use multiple outputs simultaneously bcz i can not use the whole the cpu for the 1 encode

    ffmpeg -i input \
    -s 1280x720 -acodec … -vcodec … output1 \
    -s 640x480 -acodec … -vcodec … output2 \
    -s 320x240 -acodec … -vcodec … output3
    i tried this but i dont know how to do it in two pass bcz in two pass we use "\" again
    ffmpeg -i input \
    -s 1280x720 -acodec … -vcodec … output1 \
    -s 640x480 -acodec … -vcodec … output2 \
    -s 320x240 -acodec … -vcodec … output3
    ffmpeg -y -i "..." -c:v libx264 ... mp4 NUL && ^
    ffmpeg -i "..." -c:v libx264 ... output
    if we use the multiple output with two pass
    ffmpeg -i input \
    -s 1280x720 -acodec … -vcodec … mp4 NUL && ^
    ffmpeg -i ".." -vcodec ... output1 ^
    and again for the two outputs
    this isnt worked
    Quote Quote  
  4. ffmpeg -y -i "..." ^
    -s 1280x720 -filter:v "subtitles=..."-c:v libx264 -b:v 1200k -pass 1 -profile:v high -level 4.1 -c:a aac -b:a 96k -ac 2 -f mp4 NUL && ^
    ffmpeg -i "..." -s 1280x720 -filter:v "subtitles=..."-c:v libx264 -b:v 1200k -pass 2 -profile:v high -level 4.1 -c:a aac -b:a 96k -ac 2 "1280p.mkv" ^
    -s 854x480 -filter:v "subtitles=..."-c:v libx264 -b:v 600k -pass 1 -profile:v high -level 4.1 -c:a aac -b:a 64k -ac 2 -f mp4 NUL && ^
    ffmpeg -i "..." -s 854x480 -filter:v "subtitles=..."-c:v libx264 -b:v 600k -pass 2 -profile:v high -level 4.1 -c:a aac -b:a 64k -ac 2 "854p.mkv" ^
    -s 1920x1080 -filter:v "subtitles=..."-c:v libx264 -b:v 2400k -pass 1 -profile:v high -level 4.1 -c:a aac -b:a 128k -ac 2 -f mp4 NUL && ^
    ffmpeg -i "..." -s 1920x1080 -filter:v "subtitles=..."-c:v libx264 -b:v 2400k -pass 2 -profile:v high -level 4.1 -c:a aac -b:a 128k -ac 2 "1080p.mkv"
    Unable to find a suitable output format for 'libx264'
    libx264: Invalid argument
    Quote Quote  
  5. Make sure you didn't forget any spaces. E.g. instead of:
    Code:
    "subtitles=..."-c:v libx264
    you need
    Code:
    "subtitles=..." -c:v libx264
    And like I said: use -passlogfile to set a different stats file for each output (or create one stats in first pass and re-use it for every output in second pass).
    Quote Quote  
  6. Why are you doing this ?

    If no additional processing is being done besides resize, subtitles, wouldn't it be faster just to use 3 separate simultaneous ffmpeg instances ?

    The usual thinking is 1 read operation is better than more than 1, but decoding is rarely a bottleneck (assuming no I/O problems (slow storage, fragmented HDD), unless you're >UHD or maybe some unoptimized decoder (maybe some codecs in development AV-1 right now), and usually only a small fraction of CPU usage

    480p version will encode much faster than 1080p version - but doing 1 read operation for multiple outputs will bottleneck the 480p encode . You will end up with lower CPU usage, slower FPS overall. You will end up encoding as slow as the slowest version.
    Quote Quote  
  7. Originally Posted by poisondeathray View Post
    Why are you doing this ?

    If no additional processing is being done besides resize, subtitles, wouldn't it be faster just to use 3 separate ffmpeg instances ?

    The usual thinking is 1 read operation is better than more than 1, but decoding is rarely a bottleneck (assuming no I/O problems (slow storage, fragmented HDD), unless you're >UHD or maybe some unoptimized decoder (maybe some codecs in development AV-1 right now)

    480p version will encode much faster than 1080p version - but doing 1 read operation for multiple outputs will bottleneck the 480p encode . You will end up with lower CPU usage, slower FPS overall. You will end up encoding as slow as the slowest version.
    thanks for your help
    Quote Quote  
  8. Cases where it might be faster/better/useful is where you have additional processing shared by all output versions e.g. some filters ; Then you "save" the additional processing for each version by only having to do it once instead of "n" times. You obviously can't share the resize operation (each requires separate)

    I don't know how "slow" the ffmpeg subtitle filter is, but if it's applied before each resized output version, it might be possible to save that processing time. (applied once instead of 3 separate versions)
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!