usbcamcord - simultaneous display & record of usb cam

Moderator: Forum moderators

User avatar
greengeek
Posts: 1200
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 340 times
Been thanked: 145 times

Re: usbcamcord - simultaneous display & record of usb cam

Post by greengeek »

ozsouth wrote: Wed Aug 30, 2023 7:25 am

@greengeek - ffmpeg-sml .pet should work with non-usrmerge Ubuntu type pups (as well as Fossa64 pups) - it is actually from ScPup64-20.06, with lib paths adjusted.

@ozsouth - thanks for that. Can I ask a question about the ffmpeg in F95Mid please - am I correct in believing that it is the same ffmpeg-sml you are referring to?
Cheers!

ozsouth
Posts: 1359
Joined: Sun Jul 12, 2020 2:38 am
Location: S.E. Australia
Has thanked: 210 times
Been thanked: 601 times

Re: usbcamcord - simultaneous display & record of usb cam

Post by ozsouth »

@greengeek - Yes, is in both Mid & Less.

User avatar
mikewalsh
Moderator
Posts: 5572
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 570 times
Been thanked: 1679 times

Re: usbcamcord - simultaneous display & record of usb cam

Post by mikewalsh »

@greengeek :-

Morning, Ian.

With regard to using the JvS statics, I've been using them across the kennels for 2-3 years or more, ever since Fred put me onto them. I just follow the instructions that come with each tarball; replace the existing ffmpeg & ffprobe with the statically-compiled ones in the package. (You can replace the supplied qt-faststart too, if you want, but I'm honestly not sure what this does, so.......it's at your discretion, I guess).

I'm assuming you need the matching ffprobe because ffmpeg itself will often refer to it if, for instance, you're querying outputs'n'stuff (which UsbCamCord does). I don't know for certain, but I don't think ffplay & ffserver get much use in Puppy, if at all; so far as playback goes, most of us just use our default media player for the task. I know I do. Ffmpeg itself is the main one we're concerned with; this is what does all the work.

As far as Tahrpup is concerned - and this applies to both Tahr32 AND Tahr64 - what I do is to remove /usr/bin/avconv (this is part of the weird LibAv thing Canonical were using that year, and apparently fulfills the same functionality in that setup), then recreate it as a sym-link to ffmpeg itself. It's a tip I got from another Puppian on the old Forum (can't remember who it was), but it seems to work nicely.

Yes, you CAN use it as a 'portable' package (alongside the existing one). I often do this, but I set this up outside the 'save', and of course to use it you MUST specify the absolute, 'full' $PATH to it. And this way, you can - if you want - share one external set between multiple Puppies.

I'm far from being an expert with ffmpeg, but if you think I can help with any queries, ask away..!

Mike. ;)

Puppy "stuff" ~ MORE Puppy "stuff" ~ ....and MORE! :D
_______________________________________________________

Image

ozsouth
Posts: 1359
Joined: Sun Jul 12, 2020 2:38 am
Location: S.E. Australia
Has thanked: 210 times
Been thanked: 601 times

Re: usbcamcord - simultaneous display & record of usb cam

Post by ozsouth »

@mikewalsh & @greengeek - if you want compatibility with many pups, static (despite the size) is the way to go - all needed libs are included. For Fossa64-Mid (& Less) the included 7.5mb ffmpeg will do & to Fossa64-Mid's 1st post I've attached 38kb ffprobe (also from ScPup64-20.06), which can be added. That combo should work on Bionic64 & Xenial64, but hard to test without removing already-installed versions, as their libs may be used by other apps.

User avatar
mikewalsh
Moderator
Posts: 5572
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 570 times
Been thanked: 1679 times

Re: usbcamcord - simultaneous display & record of usb cam

Post by mikewalsh »

@ozsouth :-

I concur about the statics. Yes, I know they're huge compared to Puppy 'originals', but since I've had this HP desktop rig, maxed-out the RAM to 32GB and added 5TB+ of additional storage, I've long since given up obsessing about small file sizes. When I had the old Compaq rig, resources were MUCH tighter, and I had to be careful with what I installed.

I'm here using JvS's 5.1.1 statics throughout the kennels; ffmpeg & ffprobe at 75MB each. So what? The system hardly even notices they're there. I do at least share a single set between multiple Pups via sym-linking them in from outside. Some habits are hard to break..!

(I guess maxing everything out the way I have is kind of a "rebound reaction" to the old rig. I know Puppy's good for running in a relatively small envelope, but I got really fed-up, juggling everything around in order to run the things I wanted to run. Moving from early-gen DDR1 straight to late-gen DDR4 meant the "maxing-out" was that much more noticeable, of course.......but I was determined I was never going to be short on resources like that again.

Since all this occurred just as the pandemic set in, with all the attendant lockdowns, it meant I had a steady build-up of extra cash in the bank that often got wasted on unnecessary outings'n'stuff. So; I put some of it to good use..... )

Mike. ;)

Puppy "stuff" ~ MORE Puppy "stuff" ~ ....and MORE! :D
_______________________________________________________

Image

User avatar
greengeek
Posts: 1200
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 340 times
Been thanked: 145 times

Re: usbcamcord - simultaneous display & record of usb cam

Post by greengeek »

mikewalsh wrote: Fri Aug 25, 2023 3:27 pm

Code: Select all

ffmpeg -f alsa -ac 2 -i hw:5 -f v4l2 -i /dev/video0 -vcodec libx264 recording.mp4 -map 0:v? -vf "format=yuv420p" -f xv Camera_display_output

...
Just out of curiosity, where did you dig that "format=yuv420p" up from? I'm still trying to figure out exactly what it IS specifying! :? Seems to work, though.....and 'xv' I recognise as one of the output formats listed by SMPlayer.

As far as I have been able to determine - the "format=yuv420p" in the syntax above is setting the format of the output stream that is fed to the X video display window (ie it is related to the xv stream rather than the usbcam stream). I have experimented with changing it to yuyv422 (matching the raw camera output) and it seems happy to accept that.

I also experimented with setting it to mjpeg (again - to match the output stream I had selected from the camera at that time) but this failed. I guess that means the X video display code is only able to handle non-compressed streams - just spitballin' here, IDK for sure.

User avatar
greengeek
Posts: 1200
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 340 times
Been thanked: 145 times

Re: usbcamcord - simultaneous display & record of usb cam

Post by greengeek »

I have been experimenting to improve reliability of video compatibility across different devices and players and this version is a test version to help with that. Worth a try as it seems quite good for me so far. (Will add to first post when I am fully happy with it)

It adds extra output formats (ie: suffix/extension).
Adds more codec control. Found that mpeg4 is much more compatible across devices than some other codecs.
Rearranged the variables so that the most useful defaults are shown up front (so just click and run without needing to sort through the variables)
- Have set framerate "25" as the default choice as some formats and players do not support 10 or 15 fps.

Got rid of the colons between H,M and S in the name timestamp as this was preventing playback on some devices.

usbcamcord_v10.gz
Remove fake .gz, then make executable
(5.03 KiB) Downloaded 38 times
User avatar
greengeek
Posts: 1200
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 340 times
Been thanked: 145 times

Re: usbcamcord - simultaneous display & record of usb cam

Post by greengeek »

As per my previous post - selecting mpeg4 as the codec increases the chances of the output video being compatible across a wider range of devices.

However - I also want to have the option of making file size the determinant factor - so this version DEFAULTS to the previous compatibility preferences - whilst also offering a "variable crf" factor for situations where you specifically choose libx264 (codec) combined with mp4 (extension).

Hope that is not too confusing.

A choice of lower crf means bigger file size. eg: "0" means "lossless" (huge file size) whereas higher crf numbers (eg 28) mean reduced file size.

The reduction in file size using this libx264/mp4 combo is quite remarkable. (Just don't expect it to be readable everywhere else - trial and error recommended).

v11crf.jpg
v11crf.jpg (52.7 KiB) Viewed 574 times
usbcamcord_v11_variablecrf.gz
Remove false .gz suffix, then make executable.
(5.67 KiB) Downloaded 36 times
User avatar
mikewalsh
Moderator
Posts: 5572
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 570 times
Been thanked: 1679 times

Re: usbcamcord - simultaneous display & record of usb cam

Post by mikewalsh »

@greengeek :-

Just had a quick look at this, Ian. Everything seems fine so far. I'm off down the supermarket to do a late shop; we're having an unseasonably hot spell here for the time of year.....high 80s, set to last for around the next 10 days or so. (It'll please some folk, no doubt, 'cos this summer has been a very English one; cool, cloudy and quite a bit of rain. The sun-worshippers'll love this..! Me, I can't stand it. Loathe the heat. Always have done.)

I'll look into it some more over the next day or two. Will report back.

Mike. ;)

Puppy "stuff" ~ MORE Puppy "stuff" ~ ....and MORE! :D
_______________________________________________________

Image

User avatar
greengeek
Posts: 1200
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 340 times
Been thanked: 145 times

Re: usbcamcord - simultaneous display & record of usb cam

Post by greengeek »

Test version v12:
Good compatibility.

In running compatibility tests I discovered that Fossa9.5 "Less" is a bit limited with which video formats it can handle and is a bit picky about how mp4 files are formatted. (It uses Palemoon as a default media player and needs pix-fmt yuv420p as the output file format).

I notice that files which play well in "Less" seem to be very compatible elsewhere too - so the defaults in this version are set for the best compatibility I can find so far.

The addition of more choices does increase the size of the gui and potentially may confuse the user more - but in general just accept the defaults and click Record.
(Obviously change the settings if you need to, and see what combinations work for your target device)

The crf adjustment is handy for changing the balance of file size/quality (but be warned that Fossa "Less" cannot handle files created with a crf value of 0 which is a large, lossless file. So i have set 28 as the default)

usbcamcord_v12crf.jpg
usbcamcord_v12crf.jpg (43.52 KiB) Viewed 554 times
usbcamcord_v12_variablecrf.gz
Remove false .gz suffix then make executable
(6.02 KiB) Downloaded 32 times
User avatar
mikewalsh
Moderator
Posts: 5572
Joined: Tue Dec 03, 2019 1:40 pm
Location: King's Lynn, UK
Has thanked: 570 times
Been thanked: 1679 times

Re: usbcamcord - simultaneous display & record of usb cam

Post by mikewalsh »

greengeek wrote: Tue Sep 05, 2023 9:41 pm

The addition of more choices does increase the size of the gui and potentially may confuse the user more - but in general just accept the defaults and click Record.
(Obviously change the settings if you need to, and see what combinations work for your target device)

Hm. I don't use GTK-dialog, as I've stated on many occasions over the years - I find it dreadfully confusing, with all those 'tags' to get in just the right place; I just don't have the patience with it - which is why I've always gone with YAD. SO much simpler. Does GTK-dialog allow dual columns to be used? YAD does; like this (the multi-choice browser selector I put together for my own use; developing all those portables, most are on my system more or less permanently, and I can't be arsed to dig through the Menu every time I want a different one!):-

Image

Or this one, the GUI for the 'dd'-based DriveSpeed! drive speed tester I put together a couple of years ago:-

Image

I've no idea what GTK-dialog's capabilities are. But I was thinking that if it CAN do something similar, it might be a way to condense & 'tidy-up' your GUI. There's an awful lot of empty space there!

Just a thought, like. When ya start building GUIs, there's no end of "design" considerations to take into account, too, y'know.....

Mike. ;)

Puppy "stuff" ~ MORE Puppy "stuff" ~ ....and MORE! :D
_______________________________________________________

Image

User avatar
greengeek
Posts: 1200
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 340 times
Been thanked: 145 times

Re: usbcamcord - simultaneous display & record of usb cam

Post by greengeek »

mikewalsh wrote: Wed Sep 06, 2023 1:14 am

Does GTK-dialog allow dual columns to be used?

Good question. I confess I don't know the answer unfortunately.
I certainly like the look of your yad guis - but I just try to do what I can with the basics that "come in the tin". Especially with something like Ozsouth's Fossa Mid and Fossa Less which is where I am spending most of my time lately. (They suit my older hardware...)
I like the challenge of squeezing blood out of a stone. :)

If it is possible I would certainly like to know how to present a GTK gui in Landscape mode rather than Portrait.

User avatar
greengeek
Posts: 1200
Joined: Thu Jul 16, 2020 11:06 pm
Has thanked: 340 times
Been thanked: 145 times

Re: usbcamcord - simultaneous display & record of usb cam

Post by greengeek »

mikewalsh wrote: Wed Sep 06, 2023 1:14 am

When ya start building GUIs, there's no end of "design" considerations to take into account, too, y'know.....

Actually youve just reminded me of something amazing that SFR created on the old forum. I have just posted it as a future reference to try to learn some better gui skills:

viewtopic.php?p=98084#p98084

Post Reply

Return to “Security/Privacy”