1 year ago

#187963

test-img

Alex.Foster

Work around for FFMPEG filter 'hue' not keeping sound

Writing a little compression program, but the option i added to make it black and white also removes the sound, and I'm not entirely sure if this is a problem with my code or if the filter just doesn't keep the sound file. The else statement is where the issue is. I was just wondering if the only way to get it to work is to recombine the audio file of the video at the end, which will probably take the output file over the compression target. Help appreciated.

if noSound.get() == 0 and noColour.get() == 0:
        ffmpeg.output(i, videoFileName,
                    **{'c:v': 'libx264', 'b:v': videoBitrate, 'pass': 2, 'c:a': 'aac', 'b:a': audioBitrate, 'f' :'mp4', }
                    ).overwrite_output().run()
        print('not selected')
                    
    elif noSound.get() == 1 and noColour.get() == 0:                                     ##YOU ARE HERE TRYING TO GET FILTERS TO WORK
        ffmpeg.output(i, videoFileName, 
                    **{'c:v': 'libx264', 'b:v': targetTotalBitrate, 'pass': 2,'an':None, 'f' :'mp4'}
                    ).overwrite_output().run()
        print('Only Mute Selected')
    elif noSound.get() == 1  and noColour.get() == 1:                                     ##YOU ARE HERE TRYING TO GET FILTERS TO WORK
        i = ffmpeg.filter(i,'hue', s='0')
        ffmpeg.output(i, videoFileName, 
                    **{'c:v': 'libx264', 'b:v': targetTotalBitrate, 'pass': 2,'an':None, 'f' :'mp4'}
                    ).overwrite_output().run()
        print('Only Both Selected')
    
    else:
        i = ffmpeg.filter_(i,'hue', s='0')
        ffmpeg.output(i, videoFileName, 
                    **{'c:v': 'libx264', 'b:v': videoBitrate, 'pass': 2, 'c:a': 'aac', 'b:a': audioBitrate, 'f' :'mp4', }
                    ).overwrite_output().run()
        print('Only Greyscale Selected')

python

ffmpeg

compression

ffmpeg-python

0 Answers

Your Answer

Accepted video resources