You are not logged in.

#1 2015-05-22 21:04:16

esa
Member
Registered: 2011-12-29
Posts: 143
Website

VHS - Video Handler Script, using ffmpeg

Hello everyone

I'd like to present my newest script: VHS, given the name, its all about videos.
It is a wrapper/handler for ffmpeg
NOTE: It also requires TUI (Text User Interface), for which installation GIT (or wget & unzip) will be required, please install GIT in advance.

Having a minimal system in mind, why would i use this, as it requires that TUI dependency?
Because other than ffmpeg (which then needs its codecs) and tui (which only requires awk, bash, grep and sed, read, printf) to display, handle and manage the tasks and replaces (for me) recordMyDesktop, ogmrip, rythmbox, which i think is a quite good turn-in, package count- and storage size-wise.

It has reached: final release 2.0
See my BLOG about it.
If no bug reports are made at github, i assume it works perfectly fine for you too. (exception: vobcopy!! i already told the author)

The main purpose for this script is to convert a video to another container, so i can watch them saved on the NAS on my TV.
Since i'm german speaking, but i like original speaking too, it lets you set 2 languages within the config file, lang_force_both is false by default, so if you wish to have 2 languages in your fresh encoded videos, you have to change it to true.
This said, the 'main' lang is ger, the 2nd is 'eng', so you will need (want) to change this.
The configuration screen will show up upon first call of the script, please take your time to make the proper adjustments.

As the script, grew and i dig into the ffmpeg docs, i found examples for other nice usage of ffmpeg.
And at this time i also want to thank the guys in the ffmpeg channel for their help.

This said, the functionality includes:
1) Convert a video to another container
1.1) Get rid of unwanted audio streams
1.2) Include subtitles only when required
1.3) Make the videos smaller, but maintain a good quality
1.4) Easy option to either down- or upcode them (eg: downcode for the mobile phone, or upcode before writing a video dvd)
2) Record Screen / Desktop
3) Record Videologs using the webcam (internal or usb)
4) Record a 'Desktop' guide ; record your Desktop & Webcam as PiP
5) Extract the soundtrack of a music video (or just an intro)
6) Include external audio or subtitle tracks
7) Put a logo to top left corner
8) Put a video as pip overlay
9) Play streams audio/video
10) Streamcast: Audio, Desktop, Guide, Webcam, Video
11) Play audio in multiuser or emergency stage
12) Change volume
13) and more...

Preview:

The image below summarized the joining of 2 videos into one, and encoding that new video with 2 passes.
https://github.com/sri-arjuna/vhs/blob/ … d-join.png

Once you played a webradio like:

vhs -Pu http://mystation.com/stream.mp3

, it'll show up like:
https://github.com/sri-arjuna/vhs/blob/ … istory.jpg

And of course, when encoding a video, you'll be presented a nice progress bar tongue
https://github.com/sri-arjuna/vhs/blob/ … essbar.jpg

First Usage

Upon first call, it will open the setup dialog.
Please take your time to change the values to your prefered defaults.
This is required, so VHS requires much less arguments to be passed upon calling.

Once configured, the 'regular' calls should look like:

vhs [options] [/path/to/]file1 * ..	# Encode video files
vhs -i [/path/to/]file			# Show stream info of a media file
vhs -S		# Record screen
vhs -W		# Record from webcam
vhs -G		# Record a 'Guide' (both of the above)
vhs -D		# Encode a DVD, [I][B]-DQ dvd[/B][/I] recomended!
vhs -vP ./video.ext		# Play a video file
vhs -P *mp3		# Play audio files
vhs *		# Encode all files to default container, let ffmpeg decide the bitrates (both, video and audio files will be encoded to default/favorite extension, from config file)
vhs -B video.ext		# Encode video with favorte bitrates 
vhs -Q fhd video.ext		# Encode video to full hd, forcing 1920x1080, using 'assigned' bitrates of profile 'fhd'
vhs -q fhd video.ext		# Encode video to full hd, preserving relative dimension (recomended)

In an ideal situation, this is how i convert all videos within the current folder:

vhs *

Or if i want to save space because i think that this 10gb 1080p video is too large, this will reduce its size to about 1.3 gb:

vhs -Q fhd *

For a list of all arguments, please refer to the help screen (vhs -h)


NOTE:
The script expects the commands it generates to be working.
However, this cannot be promissed in all cases, so if it fails, use the '-v' (verbose of ffmpeg) option to analyze the cause.
There are options available to the script to 'fix' or 'bypass' most common errors that may occour, at least once you have the info from the verbose output.

Furthermore, it saves the commands within a logfile, which can be viewed by vhs -L, and i suggest to clear it after every 400 encoded videos by vhs -x, as it can grow quite large (1mb+)

Bugs & Errors
For 'bug reports' please post here the output of the 'verbose' (-Vv) call, and either attach the log or put the regarding text in [ code ] tags.
For later updates (few months after post date), please refer to: https://github.com/sri-arjuna/vhs

Known Issues

  • DvD encoding (actualy copy the vobfiles using vobcopy) does only work for most, ~75% with default mode or 'longest playtime'.


How to install:

su
<password>

cd /usr/src
git clone https://github.com/sri-arjuna/vhs.git
cd vhs

./configure --prefix=/usr
./make-install

Using the above way, you can get rid of it (uninstall) by:
Code:

su

cd /usr/src/vhs
./make-uninstall
cd ..
rm -fr vhs

Or using AUR (with yaourt example)

yaourt -S tui vhs

After that, back as regular user, please take time for a first and one time configuration.
If you plan to use the webcam/guide, please connect/enable your webcam first, so it can read its capablities and offer them in the config menu.
Code:

vhs -C

Hope this help and have fun! smile

Last edited by esa (2016-01-13 23:20:01)


Author of: TUI (Text User Interface for scripts), VHS (Video Handler Script, using ffmpeg) and YASSI (Yet Another Simple Script Installer)

Offline

#2 2015-11-25 21:29:42

esa
Member
Registered: 2011-12-29
Posts: 143
Website

Re: VHS - Video Handler Script, using ffmpeg

VHS is now version 2.6

  • The installation has been optimized, though, it requires git to be installed to install the TUI framework.

  • Several small issues had been fixed.

  • Added different .desktop files for/to:

Ease association to play audio/video files with VHS from GUI.
Directly start: Screen-/Webcam- and Guide- (the both of them) recording
Open selection of existing internetradio adresses (incl LAN-streaming play)

Since i aim for a minimal system (package count/size wise) with maximum functionality, this is the way to go (for me at least).
Personaly, i no longer have to install a(ny) media player.
That is also because all my DVDs are already encoded.

Known issues:
pacman -Syyu ; pacman -Ss vobcopy -> is not found, so dvd encoding will not work ATM.
Did i miss some important bits?

Anyone used it yet?
Any thoughts/feedback?

Hope you like it.

Last edited by esa (2015-11-25 21:29:52)


Author of: TUI (Text User Interface for scripts), VHS (Video Handler Script, using ffmpeg) and YASSI (Yet Another Simple Script Installer)

Offline

#3 2015-11-26 08:34:36

esa
Member
Registered: 2011-12-29
Posts: 143
Website

Re: VHS - Video Handler Script, using ffmpeg

Holy cow, i'm sorry.
As i'm in the process of getting TUI ready for GNU, there were changes i didnt apply just before to the VHS installation (configure) script.
That should be fixed now.

Please let me know of any errors.

Namastey


Author of: TUI (Text User Interface for scripts), VHS (Video Handler Script, using ffmpeg) and YASSI (Yet Another Simple Script Installer)

Offline

#4 2015-11-26 10:52:03

chickenPie4tea
Member
Registered: 2012-08-21
Posts: 309

Re: VHS - Video Handler Script, using ffmpeg

Looks realy comprehensive!  I'll give it a try but I doubt I will use all the features, smile
Just visited the blog post where it describes the features but doesn't say anything about how to install.
I didn't find the black text on the blue background that easy to read smile
Just read the github readme but it also doesn't say anything about how you install it.
oh ok I fouind the INSTALL.md file on github
The install of vhs seems easy but on first running it nothing happens, it does't install tui for me.
I then git cloned tui and tried to install following the instructions
./configure --prefix=/ --datarootdir=/usr/share
make
su -c "make install"

but I got an error message

cp: cannot stat ‘/home/dka/Desktop/tui-master/./struct’: No such file or directory
+ exit 1

Most of the files seem to have been installed though in /usr/bin
but running vhs /path/to/video/file
and nothing happens

Last edited by chickenPie4tea (2015-11-26 16:11:22)


You can like linux without becoming a fanatic!

Offline

#5 2015-11-26 23:53:04

likytau
Member
Registered: 2012-09-02
Posts: 142

Re: VHS - Video Handler Script, using ffmpeg

Immediate impression: "How do I install it?"
Look for AUR link, nothing found.
Go to github link, no instructions.

I guess it is the standard `./configure; make; sudo make install` sequence? Either putting it on AUR or providing clear installations instructions is likely to get you more users, IMO.

EDIT: I see chickenpie4tea has noted the existence of 'INSTALL.md'.  Linking that in the readme + this post would be the minimal solution IMO.

Will comment further when installed; I am currently looking for something that will crop/scale+recode a video to an exact size.

EDIT2: ./configure says

You might to run ./make-doc-*.

Aside from the missing word, there is no file ./make-doc-* ;  `find -iname 'make*'` verifies that. So I guess this reference is outdated?

It also seems that you haven't chmod +x'd `make`, though all other make-* files are chmod +x.

After running `sudo ./make-install`,  it finishes in this:

+ git clone https://github.com/sri-arjuna/tui tui
Cloning into 'tui'...
remote: Counting objects: 5469, done.
remote: Total 5469 (delta 0), reused 0 (delta 0), pack-reused 5469
Receiving objects: 100% (5469/5469), 4.36 MiB | 543.00 KiB/s, done.
Resolving deltas: 100% (4122/4122), done.
Checking connectivity... done.
+ which tuirc
+ cd tui
+ ./configure --prefix=/usr
Please provide these commands before configuring tui!
Sadly, you must figure out the package name yourself.
::-->> txt2man
+ echo

+ echo

+ echo 'Finished installation of vhs with 0 (0=success)'
Finished installation of vhs with 0 (0=success)
+ exit

This seems like a mistake: It should not be reporting success when ./configure fails, since TUI is required.

EDIT3: after installing txt2man and rerunning `sudo ./make-install` (apparently with success), `vhs -h` does not work (it just hangs.)
running `bash -x $(which vhs)` reveals it is stuck in this loop:

for install_kind in '"/"' '"/usr"' '"$HOME/.local"' '"$HOME"' '"."' '"../conf.tui"'
++ tmp_cfg=../conf.tui/etc/tui.conf
++ '[' -f ../conf.tui/etc/tui.conf ']'
++ '[' -z '' ']'
++ for install_kind in '"/"' '"/usr"' '"$HOME/.local"' '"$HOME"' '"."' '"../conf.tui"'
++ tmp_cfg=//etc/tui.conf
++ '[' -f //etc/tui.conf ']'
++ for install_kind in '"/"' '"/usr"' '"$HOME/.local"' '"$HOME"' '"."' '"../conf.tui"'
++ tmp_cfg=/usr/etc/tui.conf
++ '[' -f /usr/etc/tui.conf ']'
++ for install_kind in '"/"' '"/usr"' '"$HOME/.local"' '"$HOME"' '"."' '"../conf.tui"'
++ tmp_cfg=/home/kau/.local/etc/tui.conf
++ '[' -f /home/kau/.local/etc/tui.conf ']'
++ for install_kind in '"/"' '"/usr"' '"$HOME/.local"' '"$HOME"' '"."' '"../conf.tui"'
++ tmp_cfg=/home/kau/etc/tui.conf
++ '[' -f /home/kau/etc/tui.conf ']'
++ for install_kind in '"/"' '"/usr"' '"$HOME/.local"' '"$HOME"' '"."' '"../conf.tui"'
++ tmp_cfg=./etc/tui.conf
++ '[' -f ./etc/tui.conf ']'
++ for install_kind in '"/"' '"/usr"' '"$HOME/.local"' '"$HOME"' '"."' '"../conf.tui"'
++ tmp_cfg=../conf.tui/etc/tui.conf
++ '[' -f ../conf.tui/etc/tui.conf ']'
++ '[' -z '' ']'
++ for install_kind in '"/"' '"/usr"' '"$HOME/.local"' '"$HOME"' '"."' '"../conf.tui"'

So I guess that the TUI install did not set up some config file that is expected here?

Last edited by likytau (2015-11-27 00:15:46)

Offline

#6 2015-11-27 06:06:57

esa
Member
Registered: 2011-12-29
Posts: 143
Website

Re: VHS - Video Handler Script, using ffmpeg

Installation
I'm sorry for the inconvenience.
I had forgotten to update the url to download the most recent TUI version, as it moved from github.com to savanna.nongnu.org.

This said, you (the script) accidently didnt download (due to outdated url) the most recent version of TUI, which also cause parts of the experienced issues.
In conclusion, as you suggested, TUI wasnt installed properly and therefor VHS could not work as expected.

Updated the first post and added an '(un-)install howto', as well as in the README.md


Readability
If you are having problems reading the blue/white output (theme: default), depending wether bash completion works or not (not for me atm sad.. )

tuirc theme <THEME>

Where <THEME> is one of the output:

ls /usr/share/tui/themes/

--> default  default-border  default-red  dot-blue  dot-red  floating  mono  witch-purple  witch-yellow
NOTE: default-border is still experimental - and might break the display at some places.
default-red is the default theme for the root user.

But i'm not much of an artist in such matters. (i'm very willing to apply suggested theme ideas) tongue

Should work now.
Thank you for your feedbacks!

Last edited by esa (2015-11-27 06:10:20)


Author of: TUI (Text User Interface for scripts), VHS (Video Handler Script, using ffmpeg) and YASSI (Yet Another Simple Script Installer)

Offline

#7 2015-11-27 12:03:05

chickenPie4tea
Member
Registered: 2012-08-21
Posts: 309

Re: VHS - Video Handler Script, using ffmpeg

ok I see the version of tui I installed was wrong.
I uninstalled it and installed VHS again following your new instructions in the First post and it installed fine and also this time installed TUI for me.
BUT, when I do a test
vhs -e mp4 /path/to/video.flv      (I also tried an .avi)
I got error message
"gawk: cmd. line:12: (FILENAME=/home/dka/.config/vhs/presets FNR=12) fatal: division by zero attempted"
although the file did get encoded to mp4

Last edited by chickenPie4tea (2015-11-27 12:10:27)


You can like linux without becoming a fanatic!

Offline

#8 2015-11-27 12:28:55

esa
Member
Registered: 2011-12-29
Posts: 143
Website

Re: VHS - Video Handler Script, using ffmpeg

It might been only display upon first vhs invocation, as the FILENAME=/home/dka/.config/vhs/presets  did not exist.

Or is it displayed upon every call?

If so, then that might be due to the intial faulty installation, the user config files might not have been written successfully (and are not removed by uninstall, so it reused faulty configs).
Try:

rm -fr ~/.config/vhs

Then reconfigure:

vhs -C

Hth


EDIT:
Nevermind, just figured i got that too, just overseen until now..
Didnt figure as everything was working fine too.

Working on that now.

EDIT2 - Hotfix:

sed s,"pal","#pal",g -i ~/.config/vhs/presets
sed s,"ntsc","#ntsc",g -i ~/.config/vhs/presets

Last edited by esa (2015-11-27 13:10:45)


Author of: TUI (Text User Interface for scripts), VHS (Video Handler Script, using ffmpeg) and YASSI (Yet Another Simple Script Installer)

Offline

#9 2015-11-27 13:02:04

chickenPie4tea
Member
Registered: 2012-08-21
Posts: 309

Re: VHS - Video Handler Script, using ffmpeg

yes as you have discovered it was not an old config file as I made sure to remove them before re-installing vhs
and yes my solution was to comment the lines out.
what is puzzling me now is where vhs is putting my converted videos as I cant find them!
where is this set in the config file?
edit, I was mistaken I thought the file was encoded but I see now it failed (on 2 different files) so that's why I cant find it smile

Last edited by chickenPie4tea (2015-11-27 13:12:03)


You can like linux without becoming a fanatic!

Offline

#10 2015-11-27 13:08:32

esa
Member
Registered: 2011-12-29
Posts: 143
Website

Re: VHS - Video Handler Script, using ffmpeg

When recording: It uses XDG_VIDEOS_DIR or defaults to $HOME/Videos, not good?
When re-encoding: it places within the samecurrent directory of the user, if the same file extension, it starts numbering.

EDIT:
If encoding fails/aborting, try

-v

to figure out why.

hth

Last edited by esa (2015-11-27 13:20:49)


Author of: TUI (Text User Interface for scripts), VHS (Video Handler Script, using ffmpeg) and YASSI (Yet Another Simple Script Installer)

Offline

#11 2015-11-27 19:25:25

chickenPie4tea
Member
Registered: 2012-08-21
Posts: 309

Re: VHS - Video Handler Script, using ffmpeg

Yes thanks the -v flag was very handy
I changed the audio codec used in the container file and now it works

# mp4 mp4	true	true	mp4als         libx264
mp4	 mp4	true	true	ac3		     libx264

You can like linux without becoming a fanatic!

Offline

#12 2015-11-28 05:28:58

esa
Member
Registered: 2011-12-29
Posts: 143
Website

Re: VHS - Video Handler Script, using ffmpeg

Thank you chickenPie4tea for your feedbacks.

Important notice, even if you dont like VHS and plan to uninstall, UPDATE FIRST!
The 2.6? configure script had an unsafe method to remove icons and desktop files. (as that functionality was just added)
After getting the new 2.7? code, please run your original ./configure command again, to update the make-uninstall script, before uninstalling!

Either way, there are some other fixes:

2015.11.27 - vhs - 2.7

  • vhs: Should no longer loop endless if playstatus tempfile is missing

  • vhs: Dependency installation tries to install only ffmpeg and v4l-utils

  • vhs -C: Optimized config preview

  • vhs.conf: if FFSERVER_CONF=!/etc/ffserver.conf, indicates ffserver.conf was not found

  • vhs.conf: ip retrievel (vhs ip) uses now 'ip addr' rather than 'ifconfig'

  • presets: commented ntsc and pal out

  • links/*.desktop: Updated name= & categories=

  • ./configure (make-uninstall): No longer removes existing applications or icons folder

EDIT:
For best experience, make sure you have TUI updated to 0.9.1 as well, there were updates to fix behaviour in the configuration editor.
'Most simple', uninstall VHS - it'll ask to remove TUI too, do so, then simply install VHS 2.7, it'll pull in the latest TUI.

Last edited by esa (2015-11-28 05:37:48)


Author of: TUI (Text User Interface for scripts), VHS (Video Handler Script, using ffmpeg) and YASSI (Yet Another Simple Script Installer)

Offline

#13 2015-11-30 17:18:44

0mark
Member
From: earth
Registered: 2010-06-09
Posts: 162
Website

Re: VHS - Video Handler Script, using ffmpeg

I like the name smile


Ceterum autem censeo Systemdinem esse delendam

Offline

#14 2015-12-03 09:33:26

chickenPie4tea
Member
Registered: 2012-08-21
Posts: 309

Re: VHS - Video Handler Script, using ffmpeg

Yes great name,
There is a small mistake in the keybinding message you get when you right-click a file and choose the VHS-audio player.
It tells you Ctr-C = next and Ctrl-Z = stop but i'ts the other way around of course.


You can like linux without becoming a fanatic!

Offline

#15 2015-12-03 10:43:59

esa
Member
Registered: 2011-12-29
Posts: 143
Website

Re: VHS - Video Handler Script, using ffmpeg

When vhs -P *, it'll be like:
CTRL+C, stops playing the current file = Stop (current), but play Next
CTRL+Z puts it to the background = Pause, gives 2 choices: type  vhs -K to Stop(kill selected instance), or fg to Continue with the playback.
It should behave/work as declared.

Figured what you mean, the 'hotfix' (continue in playlist upon empty stoped process) didnt work out as expected. (just that one time when i tested it.. grr)
So you probably experienced a 'stop play' upon ctrl+c, stating 'skipped' but didnt play the next file?

That part is the 'most recent' aside of the .desktop files.
I do want to provide more convenience on this matter/subject, but me first have to finish another project (the TUI it uses) before i can start playing with traps and escapes 'in-deep', to extend what currently is.

I'll have a look into as soon that other update for TUI (which VHS depends on) is done/out.
Sorry for the inconvenience, (edit: hope to get it fixed by/during sunday).

Thank you

Last edited by esa (2015-12-03 11:12:33)


Author of: TUI (Text User Interface for scripts), VHS (Video Handler Script, using ffmpeg) and YASSI (Yet Another Simple Script Installer)

Offline

#16 2015-12-03 12:59:38

esa
Member
Registered: 2011-12-29
Posts: 143
Website

Re: VHS - Video Handler Script, using ffmpeg

Sometimes its weird, one thinks one will be stuck on an issue for days, then its done within a 'few minutes'...

Nice part on that, i could already fix it.

2015.12.03 - vhs - 2.7.5
* Hotfix, ctrl+c now plays (again) the next item from list

Issue:
Should not had pkill'ed ffplay and continue, solution was to simply break... tongue

Have fun smile

Last edited by esa (2015-12-03 13:00:06)


Author of: TUI (Text User Interface for scripts), VHS (Video Handler Script, using ffmpeg) and YASSI (Yet Another Simple Script Installer)

Offline

#17 2015-12-04 01:07:53

esa
Member
Registered: 2011-12-29
Posts: 143
Website

Re: VHS - Video Handler Script, using ffmpeg

Roadmap (after TUI passed GNU Evaluation):

  • Improve 'playbar' (ctrl+c, etc)

  • Watch videos on console

  • Verify streaming (need feedback on this, as i can only stream (webcam/video/audio/desktop) to localhost, plays well though)


Author of: TUI (Text User Interface for scripts), VHS (Video Handler Script, using ffmpeg) and YASSI (Yet Another Simple Script Installer)

Offline

#18 2016-01-13 23:16:45

esa
Member
Registered: 2011-12-29
Posts: 143
Website

Re: VHS - Video Handler Script, using ffmpeg

Well, streaming (play, at least) works quite well:

vhs -vP http://cdn.oreillystatic.com/radar/oscon2007/OSCON_2007_Eben_Moglen.ogg

Also, by now, version 2.7.6 is installable from AUR.

As it requires TUI which is also in AUR, you might install it like:

yaourt -S tui vhs

Hope you like it and have fun smile

Last edited by esa (2016-01-13 23:17:27)


Author of: TUI (Text User Interface for scripts), VHS (Video Handler Script, using ffmpeg) and YASSI (Yet Another Simple Script Installer)

Offline

Board footer

Powered by FluxBB