Get the duration of the video file in coldfusion - coldfusion

Currently i am working with a video uploading functionality. The requirment is to show the length of the video before playing the same. SO is there any way to get the length of the video in CF. Also need to show the thumbnails of that particular video in the browser.
Thanks in advance for the help....

I used ffmpeg.exe to get all the information about video in coldfusion.
Try <cfexecute> with http://ffmpeg.org/
Command that should work -
ffprobe -loglevel error -show_streams inputFile.mp3 | grep duration | cut -f2 -d=
More details about ffprobe -
http://ffmpeg.org/ffprobe.html#Writers

Related

How to download and get video informations at the same time in youtube-dl?

In youtube-dl cli, How can i get information about the video (in json output) while the video beign downloaded by the app?
When i use this command:
youtube-dl https://www.youtube.com/watch?v=jNQXAC9IVRw
It only shows me output filename, But what a about the duration, resolution, etc... ?
I do this with 2 requests, But is it possible in on go?
It would be great if it dump the video meta data into a json file as well as output filename, Because i also struggling to pragmatically get the path of downloaded file (i have to use regex)
Just add --print-json in your command line.
youtube-dl --print-json https://www.youtube.com/watch?v=jNQXAC9IVRw
This outputs a big JSON, while video is still downloading

Is it possible to not change the file created date when embedding thumbnail using youtube-dl?

I was trying to download videos from YouTube using youtube-dl with the following:
youtube-dl -f "bestvideo+bestaudio" --merge-output-format mp4 --add-metadata --embed-thumbnail {video URL}
I want to have both the thumbnail embedded in the output file and also the upload date of the YouTube video written as the "Date created" of the output file.
I was able to write the upload date of the video on YouTube to the output file as the "Date created" by using --add-metadata {URL}.
But if I was also embedding the thumbnail to the output using --add-metadata --embed-thumbnail {URL}, the "Date created" and "Date modified" of the output file becomes the time the video thumbnail was written to the disk (aka 'now') but not the upload date of the video on YouTube.
Is there any way to get the output I want to get by using youtube-dl?
Save the date created and/or the date modified of the downloaded video.
Add metadata for thumbnail
Set the created and/or modified date using touch. To see the help for touch, type:
$ man touch
This is a youtube-dl bug, here is the relevant issue on GitHub.
Unfortunately, youtube-dl is quite bad at accepting pull requests and bug fixes, and many such bugs remain. yt-dlp (an actively maintained youtube-dl fork) doesn't seem to have this bug, so that's what I switched to now. (yt-dlp is also able to embed thumbnails to mkv files, something youtube-dl couldn't do, as well as other bugfixes and features.)

Best audio and video quality not working in youtube-dl

I tried the following command in order to get the best video and audio quality (I can also avoid to write --format best because from the documentation I read that this is the default setting):
youtube-dl.exe --format best https://www.youtube.com/watch?v=7wfUUZvybPY
and I got a video.mp4 with the following characteristics:
I downloaded the same video by using 4k Video Downloader and I got:
How can I get the same result also by using youtube-dl?
You can parse all formats available with:
youtube-dl.exe -F https://www.youtube.com/watch?v=7wfUUZvybPY
Look at first column, "format code". For this video, best option is:
youtube-dl --format 315 https://www.youtube.com/watch?v=7wfUUZvybPY for 3440x1440 video, and
youtube-dl --format 140 https://www.youtube.com/watch?v=7wfUUZvybPY for 129kbit audio.
Then, with ffmpeg, you can merge that two streams in your preferred container (you can find many answers here in Stackoverflow).
For very high bitrates there isn't a file already merged available on YouTube, ffmpeg is a crucial tool for this type of conversions!

Resume youtube-dl download for MP3s

I am trying to download an entire playlist using youtube-dl, this way :
youtube-dl -citwx --audio-format mp3 --audio-quality 320K <playlist>
I believe it extracts the audio without having to download the actual video.
The problem is that I want to be able to stop and resume this download, which is impossible using only these arguments. However, if I add the -k option, the program will download the original videos (which takes a lot longer), convert them, and keep the original files (which takes a lot more space).
Is there any way for me to resume such a transfer without having to download the actual video files?
Sounds to me like there is no way. If it takes just the audio, seems like it needs to be done in one go. Maybe try writing a script that takes the file path and url as arguments, and pass those into a youtube dl script, then when that's done also deletes the video file. takes more time that way, but the space issue is gone.
I found the answer while browsing the man page :
--download-archive FILE Download only videos not listed in the
archive file. Record the IDs of all
downloaded videos in it.
youtube-dl -citwx --download-archive progress.txt --audio-format mp3 --audio-quality 320K <playlist> is the correct command.
A note, --title is deprecated. The correct command should be youtube-dl -ciwx -o "%(title)s.%(ext)s" --download-archive progress.txt --audio-format mp3 --audio-quality 320K <playlist>

Finding Bitrate of video file

How can we find bitrate of a video file in c++? Can we do this by file handling?
Thanks
Install FFMEPG it will give you all the information related to the video
e.g.
ffmpeg -i filename.flv
If you want to implement such yourself you need to be able to read the video container format (Quicktime, ASF, AVI, Matroska etc) and try to find the bitrate from the metadata.
You can use ffprobe from the ffmpeg project to get the information about your video files and get a nice JSON ouput.
Check this answer for an example.