youtube-dl How to get subtitles filename? - download

With youtube-dl, you can get the video filename (--get-filename) and you can get the list of available subtitles (--list-subs), but it doesn't seem to have anyway to retrieve the file name of the downloaded subtitles.
If I want to only download the subtitles of a video, I'd do something like this:
youtube-dl.exe --write-sub --sub-format best --sub-lang en --skip-download -o "~/Videos/%%(title)s.%%(ext)s" YOUTUBE_URL
Then, the subtitle would download as
TITLE-en.EXTENSION
But if I do something like this
youtube-dl.exe --write-sub --sub-format best --sub-lang en --skip-download -o "~/Videos/%%(title)s.%%(ext)s" YOUTUBE_URL --get-filename
It only gives me the filename of the video.
Any help?

Related

FFmpeg extract every frame with timestamp

How can I extract every frame of an video with the respective timestamp?
ffmpeg -r 1 -i in.mp4 images/frame-%d.jpg
This code extracts all frames, but without timestamp. Since Windows do not allow ":" in filenames, I'll replace it for ".". I would like something like this:
frame-h.m.s.ms.random_value.jpg
frame-00.10.15.17.1.jpg
frame-00.11.16.04.2.jpg
frame-00.11.17.11.3.jpg
frame-00.11.17.22.4.jpg
frame-00.12.04.01.5.jpg
...
The reason of "random id" is to allow repeated frames without replacing them.
I have tried:
ffmpeg -r 1 -i rabbit.mp4 images/frame-%{pts\:hms}.jpg
But this doesn't work! => Could not open file : images/
I have no clue how can I do that! Can you help me? Thank you.

ffmpeg convert images with name pattern into video [duplicate]

I am trying to make an FFMPEG script that relied on a glob input pattern from Linux to Windows. Unfortunately that is not supported so I am looking for an alternative. I do not want to have to rename or copy the files every time I run the script because the files are used elsewhere and I cannot rename them and I would like to avoid duplication or unnecessary temporary files.
Are globs numerically sequential named images my only option here? Ideally I would like to input a list of image paths to FFMPEG as a substitute for ffmpeg -i *.jpg
The workarounds are to prepare a text file with the names and use the concat demuxer.
Or you can use image2pipe
cat *.jpg | ffmpeg -f image2pipe -framerate 25 -i - out.mp4
The best solution I could find (that's Windows compatible) was to generate a line separated list of files in a text file and pass that through to FFMPEG. For example, to generate a stabilized MP4 from a bunch of JPEGs:
ffmpeg -f concat -safe 0 -i ./files.txt -vf deshake=rx=64:ry=64 ./stabilized.mp4
Where files.txt is a list of the files in the following format. The safe option toggles the ability to have absolute/relative file paths.
# this is a comment
file 'C:/path/to/file1.jpg'
file 'C:/path/to/file2.jpg'
file 'C:/path/to/file3.jpg'

Convert image sequence to video using ffmpeg and list of files

I have a camera taking time-lapse shots every 2–3 seconds, and I keep a rolling record of a few days' worth. Because that's a lot of files, I keep them in subdirectories by day and hour:
images/
2015-05-02/
00/
2015-05-02-0000-02
2015-05-02-0000-05
2015-05-02-0000-07
01/
(etc.)
2015-05-03/
I'm writing a script to automatically upload a timelapse of the sunrise to YouTube each day. I can get the sunrise time from the web in advance, then go back after the sunrise and get a list of the files that were taken in that period using find:
touch -d "$SUNRISE_START" sunrise-start.txt
touch -d "$SUNRISE_END" sunrise-end.txt
find images/"$TODAY" -type f -anewer sunrise-start.txt ! -anewer sunrise-end.txt
Now I want to convert those files to a video with ffmpeg. Ideally I'd like to do this without making a copy of all the files (because we're talking ~3.5 GB per hour of images), and I'd prefer not to rename them to something like image000n.jpg because other users may want to access the images. Copying the images is my fallback.
But I'm getting stuck sending the results of find to ffmpeg. I understand that ffmpeg can expand wildcards internally, but I'm not sure that this is going to work where the files aren't all in one directory. I also see a few people using find's --exec option with ffmpeg to do batch conversions, but I'm not sure if this is going to work with image sequence input (as opposed to, say, converting 1000 images into 1000 single-frame videos).
Any ideas on how I can connect the two—or, failing that, a better way to get files in a date range across several subdirectories into ffmpeg as an image sequence?
Use the concat demuxer with a list of files. The list format is:
file '/path/to/file1'
file '/path/to/file2'
file '/path/to/file3'
Basic ffmpeg usage:
`ffmpeg -f concat -i mylist.txt ... <output>`
Concatenate [FFmpeg wiki]
use pattern_type glob for this
ffmpeg -f image2 -r 25 -pattern_type glob -i '*.jpg' -an -c:v libx264 -r 25 timelapse.mp4
ffmpeg probably uses the same file name globbing facility as the shell, so all valid file name globbing patterns should work. Specifically in your case, a pattern of images/201?-??-??/??/201?-??-??-????-?? will expand to all files in question e.g.
ls -l images/201?-??-??/??/201?-??-??-????-??
ffmpeg ... 'images/201?-??-??/??/201?-??-??-????-??' ...
Note the quotes around the pattern in the ffmpeg invocation: you want to pass the pattern verbatim to ffmpeg to expand the pattern into file names, not have the shell do the expansion.

Remux contents of multiple files to .mkv using batch

I have a number of video files from TV shows and I want to add subtitles subtitles to each of them. While I can use MKV merge for a few files, but here the number of files is too much, and doing each one individually would take a lot of time.
I used the following:
for %x in (*.mp4) do mkvmerge "%x" -o "%~nx.mkv"
But it will only mux mp4 to mkv, and not add the subtitles(srt). My video files and subtitles have the same name for each episode. Thank you!
try this:
for %x in (*.mp4) do mkvmerge -o "%~nx.mkv" "%~x" "%~nx.srt"
For more info look at the docu.

Convert series of images to video

I have series of images with sorted names, like 0000000354 ... 0000008591
I have tried using ffmpeg or MEncoder to convert theme. In ffmpeg the problem is this that it will operate while the names are like 0000000001 ... 00000000009 with %010d syntax.I don't know what syntax i should use for my images names.in mencoder it will cover all images But when i play the output video it doesn't show images,I want to show every image in 5 seconds or somthing like this, any one can help?
ffmpeg can't read in arbitrarily named images. You'll have to rename them or do something clever with symlinks to get ffmpeg to take them as input.
From the man page:
If the pattern contains "%d" or "%0Nd", the first filename of the file
list specified by the pattern must contain a number inclusively
contained between 0 and 4, all the following numbers must be
sequential. This limitation may be hopefully fixed.
Let's say you have:
img000001.jpg
....
img000140.jpg
....
img010040.jpg
....
To encode it into a movie using ffmpeg just use the filename pattern:
ffmpeg -i "img%06d.png" -vcodec libx264 -vpre ipod640 output.mp4

Resources