0

I have a script that is currently using wget to grab an image from a url then passing that image to ffprobe. I'd like to remove the wget dependancy. What is the best way to download this image from the URL into STDIN so that ffprobe can read it.

Current logic is:

wget_command = "wget --header=\"ApiKey: #{@config.api_key}\" -O- #{file} | "
ffprobe_command = "ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 -i"
Open3.capture3("#{wget_command} #{ffprobe_command} -")

Other places in the script use Faraday for http requests so that is ideally what I would like to use to pull the image.

halorrr
  • 1
  • 1

1 Answers1

0

What is the best way to download this image from the URL into STDIN so that ffprobe can read it.

ffprobe itself can get network resource, from ffprobe docs, your case is somewhat more complicated, but it should be possible if ffprobe does act in this are same way as ffmpeg which allows you to pass http headers, I suggest starting with following command

ffprobe -headers $'ApiKey: YOURAPIKEY' -i URLTOIMAGE -v trace
Daweo
  • 31,313
  • 3
  • 12
  • 25