Ravas coding goodies

For discussions about programming and projects not necessarily associated with Porteus.
User avatar
Rava
Contributor
Contributor
Posts: 3446
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.0rc3 x86_64 + 4.0 i586
Location: Forests of Germany
Contact:

Ravas coding goodies

Post#61 by Rava » 09 Nov 2021, 02:54

Ed_P wrote:
08 Nov 2021, 17:04
Rava wrote:
08 Nov 2021, 05:38
Neat they could name the parameters AB and C for after before and context.
:D
It makes it easier to remember.

<_<Image<_<

Then again, only recalling -C is often enough, better one or two lines too much context than one crucial line missing, be it above or below the hit.
Usually I use -C num with num > 1 unless I want a text screenshot e.g. for a forum article or for a documentation and I want the precise quote, then it could be I use -A or -B instead of -C. But for just getting the needed info, -C is more often than not the most easy way of getting it, and like I said: having more irrelevant lines is of no consequence when you still get the info you need.
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 3446
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.0rc3 x86_64 + 4.0 i586
Location: Forests of Germany
Contact:

Ravas coding goodies

Post#62 by Rava » 10 Nov 2021, 02:27

I put this into the HOWTO area of the forum, so kind of a symlink to it in here as well:
[HOWTO] get special characters not on your keyboard via Shift+Ctrl+U+"X"+number hack
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 3446
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.0rc3 x86_64 + 4.0 i586
Location: Forests of Germany
Contact:

Ravas coding goodies

Post#63 by Rava » 11 Nov 2021, 19:59

Let's presume your image viewer is viewnior.

Let's also presume your images are all in /graphics

You have several dozens of subfolders sorting /graphics into subcategories, e.g. photos/ drawings/ camera/ and whatnot. You have thousands or tens of thousands of graphic image files in /graphics overall.

If you kept a certain naming convention, you can easily view all images that follow a certain convention regardless in which subfolder/ or sub/sub/subfolder/ they actually might be.

Let's also presume part of the file names you want to watch is Screenshot1280 e.g. Screenshot1280x720_01.jpg or Screenshot1280x1024_02.webp .

You only have to open an Xterminal

Code: Select all

cd /graphics
viewnior 2>/dev/null $(find . -name '*Screenshot1280*')
Why do I use the error redirection into the garbage bin aka 2>/dev/null ? Because some images give annoying warning info, e.g. all webp, at least in my x86-64 5.0rc3 current setup.

Cave! For your viewnior to be able to support webp you have to give your system webp support since viewnior supports all image formats supported by certain system resources. Somewhere on here is a thread about how that's done.
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 3446
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.0rc3 x86_64 + 4.0 i586
Location: Forests of Germany
Contact:

Ravas coding goodies

Post#64 by Rava » 13 Nov 2021, 07:53

Today is a smaller, more basic matter. :)

Code: Select all

guest@porteus:/$ cp /tmp/psinfo_report.txt /5/porteus/debug/5.0_/2021-11-13_psinfo_report_Toshiba4CodeSatellite.txt
guest@porteus:/$ ls -l /5/porteus/debug/5.0_/2021-11-13_psinfo_report_Toshiba4CodeSatellite.txt /tmp/psinfo_report.txt
-rw-r--r-- 1 guest users 478825 Nov 13 07:51 /5/porteus/debug/5.0_/2021-11-13_psinfo_report_Toshiba4CodeSatellite.txt
-rw-r--r-- 1 root  root  478825 Nov 13 07:51 /tmp/psinfo_report.txt
As you can see:
A non-root-user like guest group users can copy a file owned by root and set his own user and group info to it as long as he can read it.
Of course user guest could not remove /tmp/psinfo_report.txt nor alter /tmp/psinfo_report.txt :

Code: Select all

guest@porteus:/$ rm /tmp/psinfo_report.txt
rm: remove write-protected regular file '/tmp/psinfo_report.txt'? y
rm: cannot remove '/tmp/psinfo_report.txt': Operation not permitted
guest@porteus:/$ echo TEST >>/tmp/psinfo_report.txt
bash: /tmp/psinfo_report.txt: Permission denied
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 3446
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.0rc3 x86_64 + 4.0 i586
Location: Forests of Germany
Contact:

Ravas coding goodies

Post#65 by Rava » 31 Dec 2021, 23:07

A very small update, my tiny new years gift. Maybe you want the videos starting in full-screen mode.
Therefore I made a new script - ffplay-hide_banner-fs
Aside from its MYNAME part is only the -fs parameter in the line about the videos:

Code: Select all

guest@porteus:/usr/local/bin$ diff ffplay-hide_banner ffplay-hide_banner-fs 
3c3
< MYNAME="ffplay-hide_banner"
---
> MYNAME="ffplay-hide_banner-fs"
12c12
< 	ffplay -autoexit -hide_banner -i "$*"
---
> 	ffplay -autoexit -hide_banner -fs -i "$*"
The code with some context:

Code: Select all

if [ $? -eq 0 ]; then
	# return zero -> video file: default
	ffplay -autoexit -hide_banner -fs -i "$*"
else
The sound-only files are still played in the smaller window as defined:

Code: Select all

	ffplay -autoexit -hide_banner -showmode waves -x 500 -y 150 -i "$*"
The easiest way for you creating /usr/local/bin/ffplay-hide_banner-fs is copying /usr/local/bin/ffplay-hide_banner to /usr/local/bin/ffplay-hide_banner-fs and do the 2 changes manually.
Cave! The lines reported by diff above most certainly will be different for your version of ffplay-hide_banner due to the extra lines I use for colour highlighting, so using diff doing your work most probably will fail.

If you also want changes to the created scripts that start all videos in the folder, just exchange in your /usr/local/bin/make-ffplay-script

Code: Select all

 echo ffplay-hide_banner \"${line}\" >>"$PARAMETER".sh
with

Code: Select all

 echo ffplay-hide_banner-fs \"${line}\" >>"$PARAMETER".sh
and you're done.
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 3446
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.0rc3 x86_64 + 4.0 i586
Location: Forests of Germany
Contact:

Ravas coding goodies

Post#66 by Rava » 12 Jan 2022, 05:18

I pondered about my approach of how make-ffplay-script handles things and found it quite disagreeable.
Reason: Using a script to play several media files via ffplay is okay, since ffplay itself not supports more than one media file at a time.

But… calling a script that then calls another script needlessly wastes system resources.
So, instead of relying on the scripts ffplay-hide_banner or ffplay-hide_banner-fs I now instead include a function in every created "Folder Name.sh" script that you can use to play all media files in "Folder Name/".

And this is the new and improved make-ffplay-script - see the version number change.

Code: Select all

#!/bin/sh
MYVERSION=V3.47 # please add V at the beginning - newest info at bottom!
# V3.4 - $1 is the relative folder with the files, will be stripped of any "/" - e.g. Filme or Filme/ works but not /mnt/sda1/video/Filme nor /mnt/sda1/video/Filme/
# for now supported file endings are
# avi 	flv	mp3	mp4	mpg	mkv	ogv	TS	ts	webm	divx 	VOB	vob
# V3.4: now added "chmod -v a+x "$PARAMETER".sh - will create error message on NTFS or VFAT fs, necessary for Linux fs like ext2,ext3 etcetera.
# V3.5: now uses ffplay-hide_banner script instead of using ffplay itself. ffplay-hide_banner distinguishes between video and media-file that is sound only. In the latter case the following is added: -showmode waves -x 500 -y 150 
# V3.46 changed into using script ffplay-hide_banner-fs (start in -fs aka full-screen mode for videos - nothing changed for audio-only-files) instead of script ffplay-hide_banner-
# V3.47 back to direct call of ffplay via function
echo make-ffplay-script $MYVERSION

if [ $# -ne 1 ]; then
	echo 'No parameter given. Need one parameter - the relative Folder e.g. "folder/".
Abort.'
	exit 2
fi

PARAMETER=$(echo "$1"|sed 's|/||g')
if [ -d "$PARAMETER" ]; then
	echo working on "$PARAMETER"… writing into "$PARAMETER".sh
	echo '#!/bin/sh
echo "$0"' >"$PARAMETER".sh
echo '# made by make-ffplay-script '$MYVERSION '- blame Rava' >>"$PARAMETER".sh
echo 'function myffplay {
ffprobe -hide_banner 2>&1 "$*" |grep Stream|grep "Video:" >/dev/null
if [ $? -eq 0 ]; then
	# return zero -> video file: default
	ffplay -autoexit -hide_banner -fs -i "$*"
else
	# return non-zero -> audio only - adjusting…
	ffplay -autoexit -hide_banner -showmode waves -x 500 -y 150 -i "$*"
fi
}' >>"$PARAMETER".sh
	find "$PARAMETER" |grep -E "\.avi$|\.flv$|\.mp[34g]$|\.mkv$|\.ogv$|\.[tT][sS]$|\.webm$|\.divx$|\.[vV][oO][bB]$" |sort | while read line ; do
{
 echo myffplay \"${line}\" >>"$PARAMETER".sh
} ; done
echo >>"$PARAMETER".sh
	chmod -v a+x "$PARAMETER".sh
else
	echo Given parameter "$PARAMETER" is not a directory. Abort.
	exit 1
fi
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 3446
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.0rc3 x86_64 + 4.0 i586
Location: Forests of Germany
Contact:

Ravas coding goodies

Post#67 by Rava » 12 Jan 2022, 05:41

Just so you know what the new FolderWhatever.sh script looks like created by make-ffplay-script V3.47 I create a dummy folder with a unplayable dummy file in it, just for showing you the resulting .sh script.

Code: Select all

guest@porteus:/tmp$ mkdir TEST
guest@porteus:/tmp$ touch TEST/test1.mp4
guest@porteus:/tmp$ make-ffplay-script TEST/
make-ffplay-script V3.47
working on TEST… writing into TEST.sh
mode of 'TEST.sh' changed from 0644 (rw-r--r--) to 0755 (rwxr-xr-x)
And the resulting script TEST.sh looks like so:

Code: Select all

#!/bin/sh
echo "$0"
# made by make-ffplay-script V3.47 - blame Rava
function myffplay {
ffprobe -hide_banner 2>&1 "$*" |grep Stream|grep "Video:" >/dev/null
if [ $? -eq 0 ]; then
	# return zero -> video file: default
	ffplay -autoexit -hide_banner -fs -i "$*"
else
	# return non-zero -> audio only - adjusting…
	ffplay -autoexit -hide_banner -showmode waves -x 500 -y 150 -i "$*"
fi
}
myffplay "TEST/test1.mp4"
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 3446
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.0rc3 x86_64 + 4.0 i586
Location: Forests of Germany
Contact:

Ravas coding goodies

Post#68 by Rava » 13 Jan 2022, 04:33

donald gave me some hints vis PM (I have his written permission to use what he wrote, telling me it's public domain info anyway) :beer: :friends:

Unfortunately it cannot be incorporated into my make-ffplay-script since make-ffplay-script is meant to work for video and audio-only files both. The reason why and the disadvantage of that concat approach is explained below.

But when you want to create a playlist for music, e.g. for a party, or as work background sound, do it like so:

Create a playlist that ffplay's concat can read:

Code: Select all

for f in *.mp3; do echo "file '$f'" >> mylist.txt; done
Cave! Alter the above if you want to include e.g. other sound-only formats, like aac or webm.
Cave²! For now it only finds files in the current directory, I think on a way to use part of my make-ffplay-script code to also find files in sub-directories but I will have to test that if it works at all, and I will have time for doing so in approx a week.

If you want a random playlist, do this:

Code: Select all

sort -R mylist.txt > randomlist.txt
Then run ffplay like so:

Code: Select all

ffplay -f concat -safe 0 -i mylist.txt -autoexit
This will play one song after the other until the playlist is fully processed.

You can add

Code: Select all

-hide_banner -showmode waves -x 500 -y 150
to have a smaller window and with waves showmode instead of ffplay's standard rdft like so:

Code: Select all

ffplay -f concat -safe 0 -i mylist.txt -autoexit -hide_banner -showmode waves -x 500 -y 150
Disadvantage :( being no scroll back / scroll forward / skip - only q = stop all, so unsuitable for video and therefore not a replacement for how make-ffplay-script handles things.
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 3446
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.0rc3 x86_64 + 4.0 i586
Location: Forests of Germany
Contact:

Ravas coding goodies

Post#69 by Rava » 20 Jan 2022, 08:03

Today it's all about a Rava coding badie aka a found but yet to be exterminated bug. :wall: .

Just found that silly bug in my make-ffplay-script , not only affecting V3.47 and V3.46, but most probably all or at least most versions.
The bug only occurs when there are two consecutive blank (whitespace) characters (hex value 0x20, ASCII code 32) in the file name (or path)… since such a file name only occurs in very rare circumstances (who wants two consecutive whitespace characters in a filename?) it took me years to find the bug at all…
Working in my momentarily very restricted free time to exterminate that bug so it could take a while doing so.

Probably the

Code: Select all

|sort |
part of

Code: Select all

	find "$PARAMETER" |grep -E "\.avi$|\.flv$|\.mp[34g]$|\.mkv$|\.ogv$|\.[tT][sS]$|\.webm$|\.divx$|\.[vV][oO][bB]$" |sort | while read line ; do
is the culprit… most probably the bug is somewhere in that one line (with many program calls piped together making debugging more difficult)


Feel free to find a solution and post it here. :D
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 3446
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.0rc3 x86_64 + 4.0 i586
Location: Forests of Germany
Contact:

Ravas coding goodies

Post#70 by Rava » 21 Jan 2022, 01:34

The solution for exterminating the bug was surprisingly simple. I just show you all steps it took me to get to the bottom of things.

Created a folder with some test files, two of these have consecutive whitespaces:

Code: Select all

guest@porteus:/1/tmp$ ls -1 make-ffplay-script/
0notification\ \ 15dB.mp3
1notification\ 15dB.mp3
2notification\ \ 15dB.mp3
The sort is not the issue

Code: Select all

guest@porteus:/1/tmp$ find make-ffplay-script/ |grep -E "\.avi$|\.flv$|\.mp[34g]$|\.mkv$|\.ogv$|\.[tT][sS]$|\.webm$|\.divx$|\.[vV][oO][bB]$" |sort
make-ffplay-script/0notification  15dB.mp3
make-ffplay-script/1notification 15dB.mp3
make-ffplay-script/2notification  15dB.mp3
but the

Code: Select all

while read line ; do echo myffplay \"${line}\"; done 
is:

Code: Select all

guest@porteus:/1/tmp$ find make-ffplay-script/ |grep -E "\.avi$|\.flv$|\.mp[34g]$|\.mkv$|\.ogv$|\.[tT][sS]$|\.webm$|\.divx$|\.[vV][oO][bB]$" |sort| while read line ; do echo myffplay \"${line}\"; done
myffplay "make-ffplay-script/0notification 15dB.mp3"
myffplay "make-ffplay-script/1notification 15dB.mp3"
myffplay "make-ffplay-script/2notification 15dB.mp3"
The solution is quite simple, using double quotes to fight the double whitespaces:

Code: Select all

guest@porteus:/1/tmp$ find make-ffplay-script/ |grep -E "\.avi$|\.flv$|\.mp[34g]$|\.mkv$|\.ogv$|\.[tT][sS]$|\.webm$|\.divx$|\.[vV][oO][bB]$" |sort| while read line ; do echo myffplay \""${line}\""; done
myffplay "make-ffplay-script/0notification  15dB.mp3"
myffplay "make-ffplay-script/1notification 15dB.mp3"
myffplay "make-ffplay-script/2notification  15dB.mp3"
And here is the newest bug-free version of make-ffplay-script - V3.48

Code: Select all

#!/bin/sh
MYVERSION=V3.48 # please add V at the beginning - newest info at bottom!
# V3.4 - $1 is the relative folder with the files, will be stripped of any "/" - e.g. Filme or Filme/ works but not /mnt/sda1/video/Filme nor /mnt/sda1/video/Filme/
# for now supported file endings are
# avi 	flv	mp3	mp4	mpg	mkv	ogv	TS	ts	webm	divx 	VOB	vob
# V3.4: now added "chmod -v a+x "$PARAMETER".sh - will create error message on NTFS or VFAT fs, necessary for Linux fs like ext2,ext3 etcetera.
# V3.5: now uses ffplay-hide_banner script instead of using ffplay itself. ffplay-hide_banner distinguishes between video and media-file that is sound only. In the latter case the following is added: -showmode waves -x 500 -y 150 
# V3.46 changed into using script ffplay-hide_banner-fs (start in -fs aka full-screen mode for videos - nothing changed for audio-only-files) instead of script ffplay-hide_banner-
# V3.47 back to direct call of ffplay via function
# V3.48 using "double quotes" because of consecutive whitespaces in filename bug
echo make-ffplay-script $MYVERSION

if [ $# -ne 1 ]; then
	echo 'No parameter given. Need one parameter - the relative Folder e.g. "folder/".
Abort.'
	exit 2
fi

PARAMETER=$(echo "$1"|sed 's|/||g')
if [ -d "$PARAMETER" ]; then
	echo working on "$PARAMETER"… writing into "$PARAMETER".sh
	echo '#!/bin/sh
echo "$0"' >"$PARAMETER".sh
echo '# made by make-ffplay-script '$MYVERSION '- blame Rava' >>"$PARAMETER".sh
echo 'function myffplay {
ffprobe -hide_banner 2>&1 "$*" |grep Stream|grep "Video:" >/dev/null
if [ $? -eq 0 ]; then
	# return zero -> video file: default
	ffplay -autoexit -hide_banner -fs -i "$*"
else
	# return non-zero -> audio only - adjusting…
	ffplay -autoexit -hide_banner -showmode waves -x 500 -y 150 -i "$*"
fi
}' >>"$PARAMETER".sh
	find "$PARAMETER" |grep -E "\.avi$|\.flv$|\.mp[34g]$|\.mkv$|\.ogv$|\.[tT][sS]$|\.webm$|\.divx$|\.[vV][oO][bB]$" |sort | while read line ; do
{
 echo myffplay \""${line}\"" >>"$PARAMETER".sh
} ; done
echo >>"$PARAMETER".sh
	chmod -v a+x "$PARAMETER".sh
else
	echo Given parameter "$PARAMETER" is not a directory. Abort.
	exit 1
fi
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 3446
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.0rc3 x86_64 + 4.0 i586
Location: Forests of Germany
Contact:

Ravas coding goodies

Post#71 by Rava » 26 Jan 2022, 09:21

As mentioned already here in the forum's 10002'nd thread (! :D ) Anyone else got this "the token was outdated" forum posting loop bug? - I enhanced my "beep" script to add some more error handling.

Here the original:

Code: Select all

#!/bin/sh
# V0.2: changed "$wavfile" to "$soundfile"
soundfile=/mnt/sda2/sound/notification_-12dB.mp3
if [ -f "$soundfile" ]; then
    #echo aplay "$wavfile"
    mpg123 "$soundfile" 2>/dev/null
else
    echo "Soundfile $soundfile not found!"
fi
and here the enhanced version, hopefully able to give you some ideas about error handling. In case of the beep script it is less necessary, but a good way of learning about error handling in my book.

Code: Select all

#!/bin/sh
# V0.2: changed "$wavfile" to "$soundfile"
# V0.3: added return value error handling due to bug when executed by root
soundfile=/mnt/sda2/sound/notification_-12dB.mp3
if [ -f "$soundfile" ]; then
	mpg123 "$soundfile" 2>/dev/null
	declare -i return=$?
	if [ $return -ne 0 ]; then
		echo "mpg123 returns non-zero value of '$return'.
Possible reasons: $0 started as root."
		exit $return
	fi
else
	echo "Soundfile $soundfile not found!"
	exit 1
fi
(I also removed the obsolete line starting with aplay since aplay can only handle voc, wav, raw or au files but no mp3 nor aac nor webm [webm can be video only, video and audio and also audio only])

And yes, unfortunately I cannot run any of the beep variants as root, not even started as a plain terminal command. Since 2>/dev/null erases all info of what mpg123 might complain about, here you have what mpg123 gives as the issue when run as root without the error redirection into the void:

Code: Select all

root@porteus:/usr/local/bin# mpg123 /mnt/sda2/sound/notification_-12dB.mp3 
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
	version 1.29.3; written and copyright by Michael Hipp and others
	free software (LGPL) without any warranty but with best wishes
[src/libout123/modules/pulse.c:open_pulse():170] error: No PulseAudio running. I will not accidentally trigger starting one.
[src/libout123/libout123.c:check_output_module():982] error: Module 'pulse' device open failed.
[src/libout123/libout123.c:out123_open():482] error: Found no driver out of [pulse] working with device <default>.
main: [src/mpg123.c:check_fatal_output():331] error: out123 error 3: failure loading driver module
Image
_____________________________________________

I cannot present you the sound played as user guest when giving you the [ code ] info of what the terminal reports, but this is what gets reported when beep was executed as guest and as root, also checking for beep's return value both as guest and as root.

As guest:

Code: Select all

guest@porteus:/usr/local/bin$ beep
guest@porteus:/usr/local/bin$ echo $?
0
guest@porteus:/usr/local/bin$ 
and as root:

Code: Select all

root@porteus:/usr/local/bin# beep
mpg123 returns non-zero value of '255'.
Possible reasons: /usr/local/bin/beep started as root.
root@porteus:/usr/local/bin# echo $?
255
root@porteus:/usr/local/bin# 
_____________________________________________

In case you might wonder:
In the other thread the sound file has -15dB in its name while here it has -12dB. Reason is: I was a bit inaccurate in giving you the code of "beep" in the "Anyone else got this "the token was outdated" forum posting loop bug?" thread, since the difference between the two files did not matter in that post.
The truth is: beep uses the -12dB variant (a bit louder) while a script called beep2 uses the -15dB variant (a bit less loud)
Look for yourself:

Code: Select all

root@porteus:/usr/local/bin# diff beep beep2
4c4
< soundfile=/mnt/sda2/sound/notification_-12dB.mp3
---
> soundfile=/mnt/sda2/sound/notification_-15dB.mp3
Last edited by Rava on 26 Jan 2022, 09:53, edited 5 times in total.
Reason: added: ● mpg123 error messages when executed as root; ● "beep" started as guest and as root; ● diff beep beep2; removed silly typo
Cheers!
Yours Rava

User avatar
Rava
Contributor
Contributor
Posts: 3446
Joined: 11 Jan 2011, 02:46
Distribution: XFCE 5.0rc3 x86_64 + 4.0 i586
Location: Forests of Germany
Contact:

Ravas coding goodies

Post#72 by Rava » 26 Jan 2022, 10:10

Just as heads up…
Rava wrote:
26 Jan 2022, 09:21
(I also removed the obsolete line starting with aplay since aplay can only handle voc, wav, raw or au files but no mp3 nor aac nor webm [webm can be video only, video and audio and also audio only])
The above might be somewhat misleading.

While true aplay can only handle voc, wav, raw or au files.

Similar is what applies to mpg123 - it also cannot play aac nor webm:

Code: Select all

guest@porteus:/tmp$ file -L test.*
test.aac:  MPEG ADTS, AAC, v4 LC, 44.1 kHz, stereo
test.webm: WebM
guest@porteus:/tmp$ mpg123 test.aac 
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
	version 1.29.3; written and copyright by Michael Hipp and others
	free software (LGPL) without any warranty but with best wishes


Terminal control enabled, press 'h' for listing of keys and functions.

Playing MPEG stream 1 of 1: test.aac ...
[src/libmpg123/parse.c:skip_junk():1276] error: Giving up searching valid MPEG header after 65536 bytes of junk.
main: [src/mpg123.c:play_frame():886] error: ...in decoding next frame: Failed to find valid MPEG data within limit on resync. (code 28)

[0:01] Decoding of test.aac finished.
guest@porteus:/tmp$ mpg123 test.webm 
High Performance MPEG 1.0/2.0/2.5 Audio Player for Layers 1, 2 and 3
	version 1.29.3; written and copyright by Michael Hipp and others
	free software (LGPL) without any warranty but with best wishes


Terminal control enabled, press 'h' for listing of keys and functions.

Playing MPEG stream 1 of 1: test.webm ...
[src/libmpg123/parse.c:skip_junk():1276] error: Giving up searching valid MPEG header after 65536 bytes of junk.
main: [src/mpg123.c:play_frame():886] error: ...in decoding next frame: Failed to find valid MPEG data within limit on resync. (code 28)

[0:01] Decoding of test.webm finished.
And the info that the webm file is audio-only via ffprobe

Code: Select all

guest@porteus:/tmp$ ffprobe test.webm 
Input #0, matroska,webm, from 'test.webm':
  Metadata:
    encoder         : nadie-telling/video-file
  Duration: 02:29:00.01, start: -0.007000, bitrate: 135 kb/s
  Stream #0:0(eng): Audio: opus, 48000 Hz, stereo, fltp (default)
ffprobe is aliased in my systems:

Code: Select all

guest@porteus:/tmp$ type ffprobe
ffprobe is aliased to `ffprobe -hide_banner'
Same with ffplay

Code: Select all

guest@porteus:/tmp$ type ffplay
ffplay is aliased to `ffplay -hide_banner -autoexit'
(Yes, ffplay would not close an audio or audio/video or video window when playing that file is finished. It explicitly needs the "-autoexit" parameter or else you manually have to close all these still open [and in my book at least] annoying windows…)
P.S. In case you might wonder: nadie in the above [ code ] about test.webm is the Spanish word, not a real existing encoder…
Cheers!
Yours Rava

Post Reply