CodeFormer icon indicating copy to clipboard operation
CodeFormer copied to clipboard

How to redo the Video Saving part

Open ada1016 opened this issue 2 years ago • 4 comments
trafficstars

So I've done processing a clip and got all png file in result, next step I believe is to convert them to MP4, I met some problem below so I reinstall them. My qestion, can I just do the Video Saving part without redo everything all over again? Given all frames has been processed.

[5209/5209] Processing: XXXX_XXXX detect 0 faces Video Saving... [mp4 @ 0x7fa87d80d800] Could not find tag for codec pcm_s16le in stream #1, codec not currently supported in container Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument Error initializing output stream 0:0 --

ada1016 avatar Feb 08 '23 13:02 ada1016

this websited can you under best forfaston are can are good are you not a king but

_

cyberkv avatar Mar 06 '23 06:03 cyberkv

don't understand what you mean. Basically I'd like to know if there is a "resume" feature on video processing cause usually my process broke at last stage, where it tried to combined all PNG back to mp4

ada1016 avatar Mar 09 '23 01:03 ada1016

I also faced the same problem, I have solved it by: In”CodeFormer/basicsr/utils/video_util.py“, there is a piece of code:


``` self.stream_writer = (
                ffmpeg.input('pipe:', format='rawvideo', pix_fmt='bgr24', s=f'{width}x{height}',
                            framerate=fps).output(
                                audio,
                                video_save_path,
                                pix_fmt='yuv420p',
                                vcodec='libx264',
                                loglevel='error',
                                acodec='copy').overwrite_output().run_async(
                                    pipe_stdin=True, pipe_stdout=True, cmd='ffmpeg'))

I modified it like this:


```self.stream_writer = (
    ffmpeg.input('pipe:', format='rawvideo', pix_fmt='bgr24', s=f'{width}x{height}',
                framerate=fps).output(
                    audio,
                    video_save_path,
                    pix_fmt='yuv420p',
                    vcodec='libx264',
                    loglevel='error',
                    acodec='aac').overwrite_output().run_async(
                        pipe_stdin=True, pipe_stdout=True, cmd='ffmpeg'))

Then the above error did not appear again. I am a person who does not understand programming languages, and I also hope that someone who understands code can explain the reason.

sochanged avatar Mar 17 '23 15:03 sochanged

self.stream_writer = (
    ffmpeg.input('pipe:', format='rawvideo', pix_fmt='bgr24', s=f'{width}x{height}',
                framerate=fps).output(
                    audio,
                    video_save_path,
                    pix_fmt='yuv420p',
                    vcodec='libx264',
                    loglevel='error',
                    acodec='aac').overwrite_output().run_async(
                        pipe_stdin=True, pipe_stdout=True, cmd='ffmpeg'))

Traceback (most recent call last): File "Z:\Program Files\PyCharm 2023.2.2\kyPROJECT\CodeFormer-master\inference_codeformer.py", line 116, in raise FileNotFoundError('No input image/video is found...\n' ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ FileNotFoundError: No input image/video is found... Note that --input_path for video should end with .mp4|.mov|.avi I DONT KNOW WHATS WRONG,ITS REDICULARS

YABIJIU avatar Oct 14 '23 12:10 YABIJIU