[FFmpeg-user] Leveraging TensorFlow and FFMPEG

rbarnes at njdevils.net rbarnes at njdevils.net
Thu Apr 18 21:47:14 EEST 2024


Hello All,

 

I am attempting to leverage Super-resolution from TensorFlow to enhance a
video.

I used FFMPEG to split out each frame.  200K of them.

I then installed TensorFlow into my windows 11 pro system and verifies the
install and path.

All good.

 

I downloaded a pre-trained model from Model Zoo.  Not sure if I even did
this right as this is all very new and very complicated.  If anyone has
experience with this stuff and can make a recommendation, that would be
awesome!!.

 

I then wrote a simple script that should enhance the individual frames.

 

Script Start:

 

echo "Applying super resolution (SRGAN) to each frame..."

$MODEL_PATH =
"C:\Super_Resolution\weights-srgan\weights\srgan\pre_generator.h5"

$OTHER_OPTIONS = ""

$files = Get-ChildItem *.png

$total_files = $files.Count

$current_file = 0

foreach ($file in $files) {

    $current_file++

    $progress = [math]::Round(($current_file / $total_files) * 100)

    echo "Processing file: $($file.Name) [$current_file/$total_files]
($progress%)"

    ffmpeg -i "$file" -vf
dnn_processing=dnn_backend=tensorflow:model=$MODEL_PATH $OTHER_OPTIONS
"enhanced_$($file.Name)"

}

 

Script End:

 

It is generating this error:

 

Input #0, png_pipe, from 'F:\Movies\Wholly_Moses\Temp_Work\frame_0001.png':

  Duration: N/A, bitrate: N/A

  Stream #0:0: Video: png, rgb24(pc, gbr/bt709/bt709), 1920x816 [SAR 1:1 DAR
40:17], 25 fps, 25 tbr, 25 tbn

[AVFilterGraph @ 000001c6d46bbc00] No option name near
'Super_Resolutionweights-srganweightssrganpre_generator.h5'

[AVFilterGraph @ 000001c6d46bbc00] Error parsing a filter description
around: 

[AVFilterGraph @ 000001c6d46bbc00] Error parsing filterchain
'dnn_processing=dnn_backend=tensorflow:model=C:\Super_Resolution\weights-srg
an\weights\srgan\pre_generator.h5' around: 

[vost#0:0/png @ 000001c6d46bcac0] Error initializing a simple filtergraph

Error opening output file enhanced_frame_0001.png.

Error opening output files: Invalid argument 

 

I have altered the parameters for "dnn_processing=dnn_backend=tensorflow" a
dozen different ways and it still generates the same error.

 

Would anyone be able to help me format a correct command syntax?

 

Please let me know if there is any other information needed to help answer
this question.

 

Regards,

-Ron



More information about the ffmpeg-user mailing list