0

There is the text file - link.txt. That file contains the following link to the video:

$ cat link.txt
https://www.quirksmode.org/html5/videos/big_buck_bunny.mp4

I can transcode the video from that file in the next way:

ffmpeg -i $(cat link.txt) -vcodec libx264 -acodec libfdk_aac out.mpg

or I can use pipe to achive the same result:

cat link.txt | ffmpeg -i - -vcodec libx264 -acodec libfdk_aac out.mpg

But I have to run FFmpeg via specific software and it doesn't support pipes and commands above.

I'm looking a solution to run FFmpeg like this:

ffmpeg -some-extra-parameters -to-say-ffmpeg -get-the-link \
       -from-the-text-file -i link.txt -vcodec libx264 \
       -acodec libfdk_aac out.mpg

Question 1: Is that feature implemented in FFmpeg?

Also, I checked FFmpeg presets and created the FFPRESET file for my goal:

$ cat /usr/local/share/ffmpeg/linkpreset.ffpreset
i=https://www.quirksmode.org/html5/videos/big_buck_bunny.mp4
vcodec=libx264
acodec=libfdk_aac

I got the error when I tried to execute FFmpeg with that preset:

$ ffmpeg -fpre /usr/local/share/ffmpeg/linkpreset.ffpreset out.mpg

/usr/local/share/ffmpeg/linkpreset.ffpreset: Invalid option or argument: 
'i=https://www.quirksmode.org/html5/videos/big_buck_bunny.mp4', 
parsed as 'i' = 'https://www.quirksmode.org/html5/videos/big_buck_bunny.mp4'

Question 2: Is there way to specify input link in a FFPRESET file?
Question 3(main): How to read an input link from a text file in FFmpeg directly(without extra tools and pipes)?

  • Do you control the text file? – Gyan Jan 14 at 4:40
  • @Gyan Yes, I control the text file – Ivan Kolesnikov Jan 14 at 6:18
1

There's no direct method to do this, but a workaround is to use the concat demuxer with a single entry.

Create a text file containing

file 'https://www.quirksmode.org/html5/videos/big_buck_bunny.mp4'

and then run

ffmpeg -f concat -safe 0 -protocol_whitelist file,https,tcp,tls,crypto -i link.txt ...

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.