Python Forum
How to find link to video file from URL - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: Web Scraping & Web Development (https://python-forum.io/forum-13.html)
+--- Thread: How to find link to video file from URL (/thread-37191.html)

Pages: 1 2 3 4


RE: How to find link to video file from URL - Pavel_47 - May-12-2022

(May-12-2022, 04:41 PM)Axel_Erfurt Wrote: Tell the player to show subs.
There is no subtitles embedded in the file. Tried on 2 machines - Windows and Ubuntu.
Probably one more option is needed.


RE: How to find link to video file from URL - Pavel_47 - May-12-2022

(May-12-2022, 04:43 PM)snippsat Wrote: Most also write to file.
--embed-subs --write-sub --sub-langs "fr"
An other option is:
yt-dlp https://www.arte.tv/en/videos/101139-013-A/geo-reportage/ --write-sub
It work,make Geo Reportage [101139-013-A].en.vtt file.
Most video player find this .vtt(sub-title file) automatic as eg VLC.
The subtitles file (.vtt) is indeed created, but it fails to be embedded.


RE: How to find link to video file from URL - Pavel_47 - Jun-11-2022

Tried with multiple options trying to obtain output file with subtitles.
None of them worked.
Here is one case (I tried to convert vtt to srt; without converting it doesn't work either):

Output:
(arte_env) pavel@ALABAMA:~/arte_env$ yt-dlp --ignore-errors --add-metadata --write-info-json --write-description --write-annotations --write-thumbnail --xattrs --all-sub --write-sub --sub-format vtt --convert-subtitles srt --embed-sub -o "bbb.mp4" "www.arte.tv/fr/videos/092925-000-A/un-million-d-annees/" WARNING: [generic] The url doesn't specify the protocol, trying with http [ArteTV] 092925-000-A: Downloading JSON metadata [ArteTV] 092925-000-A: Downloading m3u8 information [ArteTV] 092925-000-A: Downloading m3u8 information [info] 092925-000-A: Downloading 1 format(s): VO-STF-2232+VO-STF-program_audio_0-VO [info] Writing video description to: bbb.description [info] Writing video subtitles to: bbb.fr.vtt [hlsnative] Downloading m3u8 manifest [hlsnative] Total fragments: 1 [download] Destination: bbb.fr.vtt [download] 100% of 7.40KiB in 00:00 [info] Writing video subtitles to: bbb.de.vtt [hlsnative] Downloading m3u8 manifest [hlsnative] Total fragments: 1 [download] Destination: bbb.de.vtt [download] 100% of 6.98KiB in 00:00 [info] Downloading video thumbnail 0 ... [info] Writing video thumbnail 0 to: bbb.jpg [info] Writing video metadata as JSON to: bbb.info.json WARNING: There are no annotations to write. [SubtitlesConvertor] Converting subtitles Deleting original file bbb.fr.vtt (pass -k to keep) Deleting original file bbb.de.vtt (pass -k to keep) [hlsnative] Downloading m3u8 manifest [hlsnative] Total fragments: 199 [download] Destination: bbb.fVO-STF-2232.mp4 [download] 100% of 599.54MiB in 02:34 [hlsnative] Downloading m3u8 manifest [hlsnative] Total fragments: 200 [download] Destination: bbb.fVO-STF-program_audio_0-VO.mp4 [download] 100% of 35.42MiB in 00:44 [Merger] Merging formats into "bbb.mp4" Deleting original file bbb.fVO-STF-2232.mp4 (pass -k to keep) Deleting original file bbb.fVO-STF-program_audio_0-VO.mp4 (pass -k to keep) [EmbedSubtitle] Embedding subtitles in "bbb.mp4" ERROR: file:bbb.fr.srt: Invalid data found when processing input [Metadata] Adding metadata to "bbb.mp4" [XAttrMetadata] Writing metadata to file's xattrs (arte_env) pavel@ALABAMA:~/arte_env
Any comments ?
Thanks


RE: How to find link to video file from URL - snippsat - Jun-12-2022

There is a problem embed WebVTT(.vtt) in mp4
Quote:Embed WebVTT? No, not supported in MP4
So can use FFmpeg look at link or search.


RE: How to find link to video file from URL - Pavel_47 - Jun-12-2022

(Jun-12-2022, 10:52 AM)snippsat Wrote: There is a problem embed WebVTT(.vtt) in mp4
Quote:Embed WebVTT? No, not supported in MP4
So can use FFmpeg look at link or search.
I found this command searching on the web. I thought that it should work as follows:
  1. download video stream, audio stream and subtitles as .vtt
  2. merge video and audio
  3. convert subtiles .vtt to subtitles .srt
  4. embed .srt in video-audio
So the command syntax is wrong or yt-dlp just doesn't allow you to do this ?
According to your advise to build the video with subtitles, one have to proceed with 2 streps:
  1. download and merge audio & video and download subtitles .vtt using yt-dlp
  2. use FFmpeg to embed .vtt in video
Correct ?


RE: How to find link to video file from URL - Axel_Erfurt - Jun-12-2022

There is no need to download everything individually and then merge them together, yt-dlp does it all.

This works for me, VLC shows the subtitles.

yt-dlp --write-subs https://www.arte.tv/de/videos/098294-000-A/kamerun-im-clando-dem-bus-ins-exil/

Output:
yt-dlp --write-subs https://www.arte.tv/de/videos/098294-000-A/kamerun-im-clando-dem-bus-ins-exil/ [ArteTV] 098294-000-A: Downloading JSON metadata [ArteTV] 098294-000-A: Downloading m3u8 information [ArteTV] 098294-000-A: Downloading m3u8 information [info] 098294-000-A: Downloading 1 format(s): VO-STA-2312+VO-STA-program_audio_0-VO [info] Writing video subtitles to: Kamerun - Im Clando, dem Bus ins Exil [098294-000-A].de.vtt [hlsnative] Downloading m3u8 manifest [hlsnative] Total fragments: 1 [download] Destination: Kamerun - Im Clando, dem Bus ins Exil [098294-000-A].de.vtt [download] 100% of 27.20KiB in 00:00 [hlsnative] Downloading m3u8 manifest [hlsnative] Total fragments: 232 [download] Destination: Kamerun - Im Clando, dem Bus ins Exil [098294-000-A].fVO-STA-2312.mp4 [download] 100% of 724.10MiB in 11:42 [hlsnative] Downloading m3u8 manifest [hlsnative] Total fragments: 233 [download] Destination: Kamerun - Im Clando, dem Bus ins Exil [098294-000-A].fVO-STA-program_audio_0-VO.mp4 [download] 100% of 43.33MiB in 01:10 [Merger] Merging formats into "Kamerun - Im Clando, dem Bus ins Exil [098294-000-A].mp4" Deleting original file Kamerun - Im Clando, dem Bus ins Exil [098294-000-A].fVO-STA-program_audio_0-VO.mp4 (pass -k to keep) Deleting original file Kamerun - Im Clando, dem Bus ins Exil [098294-000-A].fVO-STA-2312.mp4 (pass -k to keep)



RE: How to find link to video file from URL - Pavel_47 - Jun-12-2022

(Jun-12-2022, 01:03 PM)Axel_Erfurt Wrote: There is no need to download everything individually and then merge them together, yt-dlp does it all.
This works for me, VLC shows the subtitles.
yt-dlp --write-subs https://www.arte.tv/de/videos/098294-000-A/kamerun-im-clando-dem-bus-ins-exil/
This command create downloads .vtt file with subtitles.
Then you probably load the .vtt file while playing video in VLC. Correct ?
When I talking on "embedding" I mean you don't need load it using particular layer facilities.
BTW, probably not all players have option allowing to load subtitles.


RE: How to find link to video file from URL - Axel_Erfurt - Jun-12-2022

It downloads 2 files,
Kamerun - Im Clando, dem Bus ins Exil [098294-000-A].mp4
Kamerun - Im Clando, dem Bus ins Exil [098294-000-A].de.vtt

Then I open the video in VLC and don't have to do anything extra.


RE: How to find link to video file from URL - Pavel_47 - Jun-12-2022

(Jun-12-2022, 01:25 PM)Axel_Erfurt Wrote: It downloads 2 files,
Kamerun - Im Clando, dem Bus ins Exil [098294-000-A].mp4
Kamerun - Im Clando, dem Bus ins Exil [098294-000-A].de.vtt

Then I open the video in VLC and don't have to do anything extra.

Probably VLC search subtitle file by default ?
Did you try to rename .vtt ?
I tried with "Films and TV" player on Windows and default player on Ubuntu.
The subtitles aren't visible in both cases.


RE: How to find link to video file from URL - Axel_Erfurt - Jun-12-2022

I have Linux Mint, mpv and celluloid (based on mpv) doesn't show subtitles even though you can select them.
Xplayer shows subtitles, but you have to load them.