mirror of
				https://github.com/k4yt3x/video2x.git
				synced 2025-11-03 22:21:37 +01:00 
			
		
		
		
	sorted encoder input and updated vsync to cft from 1
This commit is contained in:
		
							parent
							
								
									083af60c6f
								
							
						
					
					
						commit
						237f6336ec
					
				@ -76,7 +76,7 @@ class VideoDecoder(threading.Thread):
 | 
				
			|||||||
        self.decoder = subprocess.Popen(
 | 
					        self.decoder = subprocess.Popen(
 | 
				
			||||||
            ffmpeg.compile(
 | 
					            ffmpeg.compile(
 | 
				
			||||||
                ffmpeg.input(input_path, r=frame_rate)["v"]
 | 
					                ffmpeg.input(input_path, r=frame_rate)["v"]
 | 
				
			||||||
                .output("pipe:1", format="rawvideo", pix_fmt="rgb24", vsync="1")
 | 
					                .output("pipe:1", format="rawvideo", pix_fmt="rgb24", vsync="cfr")
 | 
				
			||||||
                .global_args("-hide_banner")
 | 
					                .global_args("-hide_banner")
 | 
				
			||||||
                .global_args("-nostats")
 | 
					                .global_args("-nostats")
 | 
				
			||||||
                .global_args(
 | 
					                .global_args(
 | 
				
			||||||
 | 
				
			|||||||
@ -19,13 +19,9 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
 | 
				
			|||||||
Name: Video Encoder
 | 
					Name: Video Encoder
 | 
				
			||||||
Author: K4YT3X
 | 
					Author: K4YT3X
 | 
				
			||||||
Date Created: June 17, 2021
 | 
					Date Created: June 17, 2021
 | 
				
			||||||
Last Modified: February 27, 2022
 | 
					Last Modified: March 1, 2022
 | 
				
			||||||
"""
 | 
					"""
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# local imports
 | 
					 | 
				
			||||||
from .pipe_printer import PipePrinter
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
# built-in imports
 | 
					 | 
				
			||||||
import multiprocessing
 | 
					import multiprocessing
 | 
				
			||||||
import multiprocessing.managers
 | 
					import multiprocessing.managers
 | 
				
			||||||
import multiprocessing.sharedctypes
 | 
					import multiprocessing.sharedctypes
 | 
				
			||||||
@ -36,10 +32,10 @@ import subprocess
 | 
				
			|||||||
import threading
 | 
					import threading
 | 
				
			||||||
import time
 | 
					import time
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# third-party imports
 | 
					 | 
				
			||||||
from loguru import logger
 | 
					 | 
				
			||||||
import ffmpeg
 | 
					import ffmpeg
 | 
				
			||||||
 | 
					from loguru import logger
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					from .pipe_printer import PipePrinter
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# map Loguru log levels to FFmpeg log levels
 | 
					# map Loguru log levels to FFmpeg log levels
 | 
				
			||||||
LOGURU_FFMPEG_LOGLEVELS = {
 | 
					LOGURU_FFMPEG_LOGLEVELS = {
 | 
				
			||||||
@ -88,7 +84,7 @@ class VideoEncoder(threading.Thread):
 | 
				
			|||||||
            "pipe:0",
 | 
					            "pipe:0",
 | 
				
			||||||
            format="rawvideo",
 | 
					            format="rawvideo",
 | 
				
			||||||
            pix_fmt="rgb24",
 | 
					            pix_fmt="rgb24",
 | 
				
			||||||
            vsync="1",
 | 
					            vsync="cfr",
 | 
				
			||||||
            s=f"{output_width}x{output_height}",
 | 
					            s=f"{output_width}x{output_height}",
 | 
				
			||||||
            r=frame_rate,
 | 
					            r=frame_rate,
 | 
				
			||||||
        )
 | 
					        )
 | 
				
			||||||
@ -110,12 +106,14 @@ class VideoEncoder(threading.Thread):
 | 
				
			|||||||
                    frames,
 | 
					                    frames,
 | 
				
			||||||
                    *[s for s in additional_streams if s is not None],
 | 
					                    *[s for s in additional_streams if s is not None],
 | 
				
			||||||
                    str(self.output_path),
 | 
					                    str(self.output_path),
 | 
				
			||||||
                    pix_fmt="yuv420p",
 | 
					 | 
				
			||||||
                    vcodec="libx264",
 | 
					                    vcodec="libx264",
 | 
				
			||||||
                    # acodec="copy",
 | 
					                    vsync="cfr",
 | 
				
			||||||
                    r=frame_rate,
 | 
					                    pix_fmt="yuv420p",
 | 
				
			||||||
                    crf=17,
 | 
					                    crf=17,
 | 
				
			||||||
                    vsync="1",
 | 
					                    preset="veryslow",
 | 
				
			||||||
 | 
					                    # acodec="libfdk_aac",
 | 
				
			||||||
 | 
					                    # cutoff=20000,
 | 
				
			||||||
 | 
					                    r=frame_rate,
 | 
				
			||||||
                    map_metadata=1,
 | 
					                    map_metadata=1,
 | 
				
			||||||
                    metadata="comment=Processed with Video2X",
 | 
					                    metadata="comment=Processed with Video2X",
 | 
				
			||||||
                )
 | 
					                )
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user