0

Video Looper Alsa Volume
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Video Looper Alsa Volume

by daboubet on Wed Aug 05, 2020 6:02 am

Hello everyone, I really hope someone can help. I'm an inexperienced user of the Raspberry. Im setting up a video looper (Raspberry Pi Video Looper). I managed to set up the whole video and its configuration trough the "video_looper.ini" file, but I still need to change the volume trough the Alsa configuration. It seems that I have to add a .txt file with a string where it says the value of the required volume. I have tried adding this file but doesn't work. Here I describe what I have been making until now. Maybe someone could offer some hints about this. I have been trying for days now without success :(.

changed the "video_looper.ini" configuration to:

Code: Select all | TOGGLE FULL SIZE
# Main configuration file for video looper.
# You can change settings like what video player is used or where to search for
# movie files.  Lines that begin with # are comments that will be ignored.
# Uncomment a line by removing its preceding # character.

# Video looper configuration block follows.
[video_looper]

# set which video player will be used to play movies.  Can be either omxplayer or
# hello_video.  omxplayer can play common formats like , mov, mp4, etc. and
# with full audio and video, but it has a small ~100ms delay between videos.
# if there is only one video omxplayer can also loop seamlessly
# hello_video is a simpler player that doesn't do audio and only plays raw H264
# streams, but loops videos seamlessly if one video is played more than once.  The default is omxplayer.
video_player = omxplayer
#video_player = hello_video

# Where to find movie files.  Can be either usb_drive or directory.  When using
# usb_drive any USB stick inserted in to the Pi will be automatically mounted
# and searched for video files (only in the root directory).  Alternatively the
# directory option will search only a specified directory on the SD card for
# movie files.  Note that you change the directory by modifying the setting in
# the [directory] section below.  The default is usb_drive.
#file_reader = usb_drive
file_reader = directory
#file_reader = usb_drive_copymode

# Copy-Mode:
# If you enable this mode, movies are copied from the usb stick to the path specified
# in the [directory] section below.
# see additonal settings for copy-mode in the [copymode] section

# The rest of the configuration for video looper below is optional and can be
# ignored.

# Control whether informative messages about the current player state are
# displayed, like the number of movies loaded or if it's waiting to load movies.
# Default is true to display these messages, but can be set to false to disable
# them entirely.
osd = true
#osd = false

#Below you can set for how many secounds the osd (and countdown) is displayed after files are found
countdown_time = 5

# Below you can set a timout time (in seconds) that is waited between each videos
# wait time is not honored for the first video that plays after starting a new playlist (e.g. after plugging in usb drive)
# when using a self looping player like hello_video wait_time is not waited between each repeat of one video but between different videos
# with omxplayer wait_time will also happen between every repeat of a video
wait_time = 0

# To play random playlist.
is_random = false

# Control the program via keyboard
# If enabled, hit ESC key to quit the program anytime (except countdown).
keyboard_control = true
#keyboard_control = false

# Set the background to a custom image
# This image is displayed between movies
# Can potentially look broken if video resolution is smaller than display resolution
# bgimage = /home/pi/static/bg.png
bgimage =

# Change the color of the background that is displayed behind movies (only works
# with omxplayer).  Provide 3 numeric values from 0 to 255 separated by a commma
# for the red, green, and blue color value.  Default is 0, 0, 0 or black.
bgcolor = 0, 0, 0

# Change the color of the foreground text that is displayed with the on screen
# display messages.  Provide 3 numeric values in the same format as bgcolor
# above.  Default is 255, 255, 255 or white.
fgcolor = 255, 255, 255

# Output program state to standard output if true.
# Useful for debugging to see whats going on behind the scenes
console_output = false
#console_output = true

# Directory file reader configuration follows.
[directory]

# The path to search for movies when using the directory file reader.
path = /home/pi/

# USB drive file reader configuration follows.
[usb_drive]

# The path to mount new USB drives.  A number will be appended to the path for
# each mounted drive (i.e. /mnt/usbdrive0, /mnt/usbdrive1, etc.).
mount_path = /mnt/usbdrive

# Whether to mount the USB drives as readonly (true) or writable (false).  It is
# recommended to mount USB drives readonly for reliability.
readonly = true


[copymode]
# this setting controls what happens when a usb drive is plugged in while in copymode
# the default setting "replace" clears out the video directory and then copies the files from the drive
# with add files from the drive are copied to the directory in addition to existing files
# NOTE: files with the same name are always overwritten
# copymode setting can be overridden by placing a file named "replace" or "add" on the drive (extension does not matter)

mode = replace
#mode = add

# with this setting you can control if a file named "loader.png" should be copied from the drive to be used eg as a background
# the file is copied to /home/pi/loader.png
copyloader = false
#copyloader = true

# this setting defines a "password" that has to exists as a file (with the password as a filename) (extension does not matter)
# on the usb drive for the videolooper to accept videos from the usb drive
# default is videopi - you should consider changing it - if it is emtpy no check will be performed
# for maximum compatibility use only ascii characters
password = videopi


[playlist]
# This setting allows for a fixed playlist.

# Path to the playlist file.
# If you enter a relative path (not starting with /) it is considered relative to the selected file_reader path (directory or USB drive).
# Leave empty to not use a playlist and play all the files in the file_reader path (directory or USB drive).
path =
#path = playlist.m3u


# ALSA configuration follows.
# This only applies when using omxplayer with sound = alsa.
[alsa]

# ALSA hardware device to use for sound output.  This consists of the card
# number and subdevice number separated by a comma, e.g. '1,0'.  Run
# 'aplay -l' to list available devices.  If empty, the default output device is
# used.
#hw_device =
hw_device = 1,0

# Volume of the hardware device can be set using a text file provided with the
# video files.  If the file does not exist, the hardware volume will remain
# unchanged.  This setting specifies the name of the text file.
# The file should contain a single line with an amixer-compatible volume value,
# such as '50%' or '-10db'.
#hw_vol_file =
hw_vol_file = alsa_volume

# Name of the ALSA control to use for adjusting volume.  Typically this will be
# 'PCM'.  Run 'amixer -c N scontrols' (where N is the card number of your output
# device) to list available controls.
hw_vol_control = PCM


# omxplayer configuration follows.
[omxplayer]

# List of supported file extensions.  Must be comma separated and should not
# include the dot at the start of the extension.
extensions = mov, mkv, mp4, m4v

# Sound output for omxplayer, either hdmi, local, both or alsa.  When set to
# hdmi the video sound will be played on the HDMI output, and when set to local
# the sound will be played on the analog audio output.  A value of both will
# play sound on both HDMI and the analog output.  A value of alsa will play
# sound through ALSA, using the device specified in the [alsa] section above.
# The both value is the default.
#sound = both
#sound = hdmi
#sound = local
sound = alsa

# Sound volume output for the video player will be read from  a  file  near  the
# video files. If the file does not exist, a default volume of 0db will be used.
# To use this feature create a file in the same directory as the videos and name
# it the value defined below (like 'sound_volume' by default), then inside the
# file add a single line with the volume value in text to pass to omxplayer (using
# its --vol option which takes a value in millibels).
# NOTE: This may introduce audible quantization error. Using hw_vol_file will
# generally give better sound quality.
sound_vol_file = sound_volume

# Fixed playlists may embed titles, which can be shown. See playlist section above.
# If no fixed playlist is given, titles are simply filenames without extensions.
show_titles = false
#show_titles = true

# Title duration in seconds. -1 means endless.
title_duration = 10

# Any extra command line arguments to pass to omxplayer.  It is not recommended
# that you change this unless you have a specific need to do so!  The audio and
# video FIFO buffers are kept low to reduce clipping ends of movie at loop.
# Run 'omxplayer -h' to have the full list of parameters.
extra_args = --no-osd --audio_fifo 0.01 --video_fifo 0.01 --align center --font-size 55

# hello_video player configuration follows.
[hello_video]

# List of supported file extensions.  Must be comma separated and should not
# include the dot at the start of the extension.
extensions = h264


Added a .txt file named "alsa_volume" with the text: "amixer -c 1 -- sset Master playback -20dB"

Put the file in the same folder as the video.


Thanks in advance, i would be thankful for some help!
best, Daniel

daboubet
 
Posts: 1
Joined: Wed Aug 05, 2020 5:40 am

Re: Video Looper Alsa Volume

by AdeKR on Fri Apr 23, 2021 9:30 pm

Hi there,

I have been using this script for years but first time I tweak it today.
Did you make sure to modify the video_looper.ini that is in the ~/boot folder?
I spend 2 hours to figure out I was tweaking the bad one ( in pi_video_looper/assets/).

Hope it helps!

AdeKR
 
Posts: 1
Joined: Fri Apr 23, 2021 9:27 pm

Re: Video Looper Alsa Volume

by RichardTaylor on Wed May 05, 2021 8:59 am

Hi there, I hope you can help!

I'm struggling with syntax. I've added volume text file reference to the video_looper.ini file, and the .txt file itself to the root directory of the video USB drive. I'm pretty sure I'm getting that bit right because the video file plays normally (at full volume) when I don't have the name or location of the file right, but when the names match and the location is correct, the video file won't play at all, which I assume is because my syntax in the text file is wrong.

I've tried "-3000",
I've tried "50%",
and I've tried "amixer -c 1 -- sset Master playback -20dB"
All without the quotation marks, and all of which seem to make sense, but cause the player to fail.
Can someone please advise the correct syntax for what should be in the .txt file?

Thanks!

RichardTaylor
 
Posts: 1
Joined: Wed May 05, 2021 8:53 am

Please be positive and constructive with your questions and comments.