Vlc: Difference between revisions

From 太極
Jump to navigation Jump to search
 
(12 intermediate revisions by the same user not shown)
Line 10: Line 10:


= Rip DVD =
= Rip DVD =
* [https://superuser.com/a/630593 How to detect whether there is a CD-ROM in the drive?] See if we got any output from '''blkid /dev/sr0'''
** [https://askubuntu.com/a/191522 CD/DVD drive not mounted when inserted with Disc of any kind]
** How to know if "/dev/cdrom" is the right input device for the DVD drive? "/dev/cdrom" is usually a symbolic link to the actual device file for the CD/DVD drive. To check if /dev/cdrom is the correct device file for your DVD drive, you can use '''ls -l /dev/cdrom'''. For example, if the output of the ls -l command shows that /dev/cdrom is a symbolic link to /dev/sr0, then /dev/sr0 is the correct device file for your DVD drive. You can also use the '''dmesg''' command to view system messages and try to identify the correct device file for your DVD drive.
* [https://www.vidmore.com/rip-dvd/dvd-to-iso/ How to Convert DVD to ISO Image File on PC, Mac or Linux]. Brasero
* [https://www.vidmore.com/rip-dvd/dvd-to-iso/ How to Convert DVD to ISO Image File on PC, Mac or Linux]. Brasero
* https://help.ubuntu.com/community/RestrictedFormats/RippingDVDs
* https://help.ubuntu.com/community/RestrictedFormats/RippingDVDs
Line 15: Line 18:
* [https://github.com/allienx/libdvdcss-dll libdvdcss] for Windows
* [https://github.com/allienx/libdvdcss-dll libdvdcss] for Windows
** https://en.m.wikipedia.org/wiki/Libdvdcss
** https://en.m.wikipedia.org/wiki/Libdvdcss
* To back up a DVD, it is suggested to add '''bs=2048''' to make the run faster; for example, '''dd if=/dev/cdrom of=DVD.iso bs=2048'''  See [https://www.geeksforgeeks.org/dd-command-linux/ ‘dd’ command in Linux] or [https://askubuntu.com/questions/147800/ripping-dvd-to-iso-accurately Ripping DVD to iso - Accurately]. The default block size is 512 (bytes).
* My experience
** Install Linux '''Mint''' + Multimedia codecs. Ubuntu Studio even cannot play the DVD using VLC.
** GRUB2 generated from Linux Mint installation will 'automatically' include Windows OS installed on another disk.
** Make sure "libdvdcss2" package has been installed.
** Use '''sudo''' + '''dd''' to back up DVD to an iso file; something like, '''sudo dd if=/dev/cdrom of=DVD.iso bs=2048 status=progress'''. If we ignore '''sudo''' the iso file size is very small (~150MB) instead of 7-8 GB. We may need to run chown on the iso file to return the owner of the file to the user. It took about 10 minutes when I used bs=2048 option (12MB/s).
** <span style="color: blue">For some unknown reason, directly run the "sudo dd" command will result in 150MB iso file (no error came out). I need to let VLC to play a little bit of the DVD and the "sudo dd" command will work successfully.</span>
** The DVD.iso can be mounted by right clicking the iso file in the file manager (Linux Mint and Ubuntu GNOME have different names. In Linux Mint, it is called '''Archive Mounter'''. In Ubuntu GNOME, it is the 1st option [https://linuxize.com/post/how-to-mount-iso-file-on-linux/ Open with disk image mounter]. VLC can play the "DVD" by selecting the mounted location instead of the regular DVD location ("/dev/sr0"). The subtitles can be selected in VLC as if we have the original DVD.
** DVD seems to have a resolution of 480p only.


= “VLC is Unable to Open the MRL” Error =
= “VLC is Unable to Open the MRL” Error =
Line 114: Line 127:


= Tips/features =
= Tips/features =
[https://linuxtldr.com/tips-and-tricks-for-vlc/ Master VLC with These 10+ Expert Tips and Tricks]
[https://itsfoss.com/simple-vlc-tips/ Make VLC More Awesome With These Simple Tips]
[https://itsfoss.com/simple-vlc-tips/ Make VLC More Awesome With These Simple Tips]
# Watch YouTube videos with VLC
# Watch YouTube videos with VLC
Line 139: Line 154:


= Use VLC to record internet radio (suitable if the stream is continuous) =
= Use VLC to record internet radio (suitable if the stream is continuous) =
* On my Debian 11, the recorded files are location in ~/Downloads folder.
* [https://wiki.videolan.org/VLC_HowTo/Set_the_recording_folder/ HowTo/Set the recording folder]. Tools -> Preferences -> Input&codecs and Record directory or filename.


== GUI ==
== GUI ==
Line 174: Line 191:
[0x7fac2c003598] access_mms access error: failed to send command
[0x7fac2c003598] access_mms access error: failed to send command
[0x7fac2c005fe8] idummy demux: command `quit'
[0x7fac2c005fe8] idummy demux: command `quit'
</pre>
== Timer for recording ==
[https://superuser.com/a/586137  Automate VLC schedule recording]. The following will run for about 30s & VLC will be closed after that. VLC media player 3.0.20 Vetinari (revision 3.0.20-0-g6f0d0ab126b) on Debian 11. This will open VLC without steaming on display. But the recording is fine. Change 'vlc' to 'cvlc' will lose audio in the recorded file.
{{Pre}}
$ vlc http://localhost:9981/stream/channel/XXXX \
  --sout "#transcode{}:duplicate{dst=std{access=file,mux=ts,dst={vlc-record}}}" \
  --run-time=30 --stop-time=31 --play-and-exit
</pre>
The '''file''' specifies that the output should be written to a file. The '''ps''' specify the file format in which the stream should be saved. In this case, it's set to '''PS (Program Stream)''', which is a container format commonly used for MPEG video streams.
{{Pre}}
$ cvlc http://localhost:9981/stream/channel/XXXX \
  --sout=file/ps:output.mp4 \
  --run-time=30 --stop-time=31 --play-and-exit
</pre>
Use the '''at''' command or creating a cron jobs for scheduled recording. Schedule a job to run at 21:05 Oct 21 2024. The date can be omitted.
{{Pre}}
echo "cvlc http://localhost:9981/stream/channel/XXXX --sout=file/ps:output.mp4 --run-time=30 --stop-time=31 --play-and-exit" | at 21:05 102124
</pre>
</pre>



Latest revision as of 20:17, 25 April 2024

Install

Uninstall

For some reason, after I uninstall VLC, sudo apt update or apt list --upgradable still prompts to install some vlc-related packages like libvlc-bin. But I can remove it by sudo apt purge --auto-remove libvlc-bin

How to play DVDs

https://help.ubuntu.com/community/RestrictedFormats/PlayingDVDs

Rip DVD

  • My experience
    • Install Linux Mint + Multimedia codecs. Ubuntu Studio even cannot play the DVD using VLC.
    • GRUB2 generated from Linux Mint installation will 'automatically' include Windows OS installed on another disk.
    • Make sure "libdvdcss2" package has been installed.
    • Use sudo + dd to back up DVD to an iso file; something like, sudo dd if=/dev/cdrom of=DVD.iso bs=2048 status=progress. If we ignore sudo the iso file size is very small (~150MB) instead of 7-8 GB. We may need to run chown on the iso file to return the owner of the file to the user. It took about 10 minutes when I used bs=2048 option (12MB/s).
    • For some unknown reason, directly run the "sudo dd" command will result in 150MB iso file (no error came out). I need to let VLC to play a little bit of the DVD and the "sudo dd" command will work successfully.
    • The DVD.iso can be mounted by right clicking the iso file in the file manager (Linux Mint and Ubuntu GNOME have different names. In Linux Mint, it is called Archive Mounter. In Ubuntu GNOME, it is the 1st option Open with disk image mounter. VLC can play the "DVD" by selecting the mounted location instead of the regular DVD location ("/dev/sr0"). The subtitles can be selected in VLC as if we have the original DVD.
    • DVD seems to have a resolution of 480p only.

“VLC is Unable to Open the MRL” Error

Fixing “VLC is Unable to Open the MRL” Error [Quick Tip]

Stream Local Videos

Find TuneIn streaming URL

Follow this video, I can get the streaming url of WQER Chinese radio.

  1. Right click and select inspect
  2. On the right panel, select 'Network' tab
  3. Pay attention to the row with long 'Waterfall'
  4. Right click and select copy -> copy link address

This method also works to find out the cbsnews/live streaming URL (https://cbsnhls-i.akamaihd.net/hls/live/264710/cbsn_hlsprod_2/master_360.m3u8). I can watch the streaming in VLC.

The method does not work on Enlightened Piano Radio which uses html5 mp3 driver. The website has an advantage of showing currently playing songs.

Sniff out the link

Video Download Helper (Firefox Add-on, 2.7M users). It works to find

Video Downloader professional (Firefox Add-on, 292K users) also has a good number of users and reviews.

Playlist

The internet streaming I played will be automatically added to LIBRARY > Playlist. These stations will be gone once I quit VLC unless I save the playlist (eg <vlc_playlist.m3u>).

Docked playlist

On Linux, View -> Check 'Docked Playlist'.

On Mac, I don't find a similar option.

Addons

Use VLC to listen tunein radio

Download link http://addons.videolan.org/content/show.php?content=152788. Click the download button to download the file "TuneIn-Radio-VLC-master.zip". Unzip it. A new folder "TuneIn-Radio-VLC-master" will be created.

curl -L https://github.com/diegofn/TuneIn-Radio-VLC/archive/master.zip > TuneinRadioVLC.zip
unzip TuneinRadioVLC.zip

Create two new subfolders and place the lua files

  • move the “tunein.lua” file to the VLC folder so it can be found and run by VLC.
    • In Linux, move the “tunein.lua” file to ~/.local/share/vlc/lua/sd/
      mkdir -p ~/.local/share/vlc/lua/sd/
      mkdir -p ~/.local/share/vlc/lua/playlist
      cp TuneIn-Radio-VLC-master/tunein.lua ~/.local/share/vlc/lua/sd/
    • In Windows, move the “tunein.lua” file to %AppData%/VLC/VideoLAN/lua/sd.
    • In Mac OS X, move the “tunein.lua” file to VLC.app/Contents/MacOS/share/lua/sd
      sudo cp TuneIn-Radio-VLC-master/tunein.lua /Applications/VLC.app/Contents/MacOS/share/lua/sd/
      sudo cp -R TuneIn-Radio-VLC-master/playlist/* /Applications/VLC.app/Contents/MacOS/share/lua/playlist/
  • move the “radiotimes.lua” and “streamtheworld.lua” files from the Playlist folder to “/lua/playlist” folder in the VLC directory.
    cp TuneIn-Radio-VLC-master/playlist/* ~/.local/share/vlc/lua/playlist/

Close and open VLC. Go to “View -> Playlist”. At the sidebar, under the Internet section, you should now see “TuneIn Radio” in the list. Click on it and you will be able to access your Favorites.

Note that

  1. the TuneIn Radio will be LOST once I upgrade VLC (tested on Mac).
  2. on Linux, right click menu has an item called 'Information'. The 'Codec' tab will show the Location (IP address) information. Mac VLC does not have 'Information'.

Youtube playlist

It does not work on my VLC 3.0.4

Taiwan radios

https://medium.com/@k21_79139/台灣電台直播源列表-a318adf3b7

Music radios

Local radios

Edit network streaming history

  • Linux, the configuration file is located at ~/.config/vlc/vlc-qt-interface.conf
  • Windows, the configure file is %appdata%/vlc/vlc-qt-interface.conf

Tips/features

Master VLC with These 10+ Expert Tips and Tricks

Make VLC More Awesome With These Simple Tips

  1. Watch YouTube videos with VLC
  2. Convert videos to different formats
  3. Record Audio/Video From Source
  4. Download subtitles automatically
  5. Take A Snapshot

15 Cool VLC Features You'll Wish You Knew Earlier!

  • 0:26 Screen Recorder. Media -> Open Capture Device. Change the capture mode to 'Desktop'. Change the frame rate to 30 or 60. Choose 'Convert' instead of 'Play'. In the next dialog, choose desired codec (eg H.264 + Mp3) and specify the output name (*.mp4 is fine for H.264 + mp3). Click 'Start' to start recording. When it's done. Click the 'Stop' button on VLC.
  • 1:27 Webcam Recorder
  • 2:08 Screenshot. Right click -> Video -> Take Snapshot (Shift + s keyboard on Windows/Linux).
  • 2:37 Convert Video/Audio. Media -> Convert and Save. Add file and click 'Convert/Save'. In the next dialog, choose the codec and specify the output filename. Click 'Start'.
  • 3:29 Record Audio, Video. View -> 'Advanced Controls'. The lower-left will have more controls. Use the red record button to start/stop the recording.
  • 3:59 Create Bookmarks. Playback -> Custom Bookmarks -> Manage. Click 'Create'.
  • 4:27 Graphic Equalizer. See the icon/button at the bottom panel.
  • 4:56 Add Watermark. Tools -> Effects and Filters. "Video Effect" -> "Overlay" -> "Add Logo" -> Save.
  • 5:53 Additional Effects
  • 6:28 Download/Stream Videos. Copy URL, paste and play. To go 'Tool' -> 'Codec Information' and copy the URL 'Location'. Paste the URL to a browser. When the video is playing in the browser, right click and choose 'Save Video As'.
  • 7:34 Wallpaper
  • 7:55 Multiple Instances
  • 8:27 Launch in Full-Screen
  • 8:55 Podcasts/Internet Radio. View -> Playlist. Podcasts and click "+" sign.
  • 9:36 Jigsaw Puzzle. Tools -> Effects and Filters. Video Effects -> Geometry. Check 'Puzzle Game' -> 'Save' button.

Use VLC to record internet radio (suitable if the stream is continuous)

  • On my Debian 11, the recorded files are location in ~/Downloads folder.
  • HowTo/Set the recording folder. Tools -> Preferences -> Input&codecs and Record directory or filename.

GUI

On VLC 3.0.8 I am using in Ubuntu 18.04, the 'stream' option is gone in Open Network Stream... dialog. This option is not gone but it is hidden under the "play" button. The "play" button has a drop-down menu with 'Enqueue', 'Play', 'Stream', and 'Convert' options. We can choose the Convert option from there. I use this method to convert a m3u8 URL and save it as a mp4 file (the 'mp4' format can be confirmed by the Video DownloadHelper add-on). For a 19:41 minutes videos, it takes 216MB disk space for the 1280x720 29.97fps video.

The URL is obtained through the Video DownloadHelper v7.3.9 (3M users) add-on/extension on Firefox.

Command line

http://www.ubuntugeek.com/how-to-record-internet-radio-using-vlc.html

sudo apt-get install vlc browser-plugin-vlc
sudo apt-get install ubuntu-restricted-extras
sudo apt-get install lame  libmp3lame0
sudo apt-get install ffmpeg
sudo apt-get install libavcodec-extra-53 libavdevice-extra-53 libavfilter-extra-2 libavformat-extra-53 \
                     libavutil-extra-51 libpostproc-extra-52 libswscale-extra-2

A successful run will have an output like

VLC media player 2.0.3 Twoflower (revision 2.0.2-93-g77aa89e)
[0x2329ca8] dummy interface: using the dummy interface module...
[0x7fac2c007428] mux_dummy mux: Open
[0x7fac2c003598] access_mms access: selecting stream[0x1] audio (39 Kib/s)
[0x7fac2c003598] access_mms access: connection successful
[0x7fac2c003598] access_mms access error: failed to send command
[0x7fac2c005fe8] idummy demux: command `quit'

Timer for recording

Automate VLC schedule recording. The following will run for about 30s & VLC will be closed after that. VLC media player 3.0.20 Vetinari (revision 3.0.20-0-g6f0d0ab126b) on Debian 11. This will open VLC without steaming on display. But the recording is fine. Change 'vlc' to 'cvlc' will lose audio in the recorded file.

$ vlc http://localhost:9981/stream/channel/XXXX \
  --sout "#transcode{}:duplicate{dst=std{access=file,mux=ts,dst={vlc-record}}}" \
  --run-time=30 --stop-time=31 --play-and-exit

The file specifies that the output should be written to a file. The ps specify the file format in which the stream should be saved. In this case, it's set to PS (Program Stream), which is a container format commonly used for MPEG video streams.

$ cvlc http://localhost:9981/stream/channel/XXXX \
  --sout=file/ps:output.mp4 \
  --run-time=30 --stop-time=31 --play-and-exit

Use the at command or creating a cron jobs for scheduled recording. Schedule a job to run at 21:05 Oct 21 2024. The date can be omitted.

echo "cvlc http://localhost:9981/stream/channel/XXXX --sout=file/ps:output.mp4 --run-time=30 --stop-time=31 --play-and-exit" | at 21:05 102124

Audio device

I can specify to use a bluetooth device to output the audio in VLC while the browser still uses the regular 3.5mm as the output.

Command line

7 VLC Command Lines You Need to Know

Play audio using a command line mode

See also my Beaglebone page for a comparison of different possibilities. For VLC, there are 3 interface modes. The following example is to run vlc in a text mode with the ncurses library.

sudo apt-get install vlc-nox
vlc -I ncurses XXX.mp3
vlc --help

Play youtube using VLC from a command line

See this post

vlc -I http https://www.youtube.com/watch?v=UlW77conmAc

Play youtube using minitube (not VLC)

https://flavio.tordini.org/minitube

Note that it can search or browse videos but you can not paste URLs to play them. Minitube can play videos continuously from searched videos.

Frame rate

File:VlcFrameRate.png

Extract Images with VLC

5 Ways to Extract Video Frames and Save to Images

Keyboard shortcuts

cheatography.com and howtogeek

  • Ctrl + arrow: forward/backward 1 minute (Add the 'CMD' key on macOS)
  • Alt + arrow: forward/backward 10 seconds (Add the 'CMD' key on macOS)
  • Shift + arrow: forward/backward 3 seconds (Add the 'CMD' key on macOS)
  • [ or -: decrease speed
  • ]: increase speed

Global Hotkeys

https://wiki.videolan.org/How_to_set_global_hotkeys/

For example, I choose F8 for play/pause.

Convert video or audio files

How to Convert a Video or Audio File Using VLC

VLC & screensaver

It seems the screensaver will be deactivated if some video is opened (even not it is not playing).

Alternatives

5 Streaming Audio Players for Linux. Spotify, Clementine, Odio, Streamtuner2, VLC.