LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-08-2016, 10:31 PM   #16
Gregg Bell
Senior Member
 
Registered: Mar 2014
Location: Illinois
Distribution: Xubuntu
Posts: 2,034

Original Poster
Rep: Reputation: 176Reputation: 176

Quote:
Originally Posted by BW-userx View Post
to screen capture with ffmpeg

Code:
ffmpeg -r 30 -s 1600x900 -f x11grab -i :0.0 -vcodec msmpeg4v2 -qscale 2 screencap001.avi
adjust the size and filename as you please. I do not think that does sound though. you'd have to check to be sure.
Hmm. So is I run that command in the terminal the webcam takes a still photo? (I think LOL I gotta have a GUI.) Thanks.
 
Old 12-08-2016, 10:32 PM   #17
Gregg Bell
Senior Member
 
Registered: Mar 2014
Location: Illinois
Distribution: Xubuntu
Posts: 2,034

Original Poster
Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by Shadow_7 View Post
Technically there a compressed stream coming off that webcam already. You shouldn't have any sync issues capturing that. It's a common device for beaglebone black, which isn't that beefy specs wise. If you have enough computes you can play it back on screen and screen capture.

Code:
$ mpv --ao=pulse --vo=opengl --video-zoom=0 --framedrop=vo \
      --no-osc --osd-level=1 --demuxer-lavf-format=video4linux2 \
      -fs /dev/video1

$ avconv -f alsa -i default -f x11grab -s 1920x1080 -r:v 5 -draw_mouse 0 \
         -i :0.0+0,0 -r:v 5 -aspect 16:9 -pix_fmt yuv444p -async 1 \
         -codec:a pcm_s16le -codec:v libx264 -pre:v lossless_ultrafast \
         -filter_complex "asyncts=compensate=1:min_delta=0.1:max_comp=500:first_pts=0" \
         -y outout.mkv

$ mpv --ao=pulse --vo=opengl --video-zoom=0 --framedrop=vo \
      --no-osc --osd-level=1 -fs output.mkv
The "async 1" is a legacy option, but is required IME to achieve av sync. The -filter_complex is the new way (in theory) but doesn't seem to do anything without "async 1". The parms past it should be defaults (long hand in case I needed to adjust). The -r:v 5 is the fps, which you have to keep without the computation specs of your device and it's optimizations. Most of mine being dual cores with 2GB ram at about 2GHz each core, so 5fps is the safe zone which allows me to capture and do stuff. And avconv which is the fork of ffmpeg in debian jessie.

Not sure if the old way of $(/dev/video0 > capture.raw) would work for that one, it does have an onboard encoder. You'll likely need to set attributes with v4l2-ctl, uvcdynctrl, and friends. With tools like vlc you need to pass the parameters to vlc if it's not the default (highest capability). guvcview is good for setting preferences, but vlc will ignore them. While mpv will go with the flow / inherit attributes IME. Where IME equals in my experience.

In the case of my c270, playback via longhand:

Code:
uvcdynctrl --device=video1 --set 'LED1 Mode' 0 'LED1 Frequency' 0; \
v4l2-ctl --device=/dev/video1 \
         --set-fmt-video=width=1280,height=960,pixelformat=MJPG --set-parm="5"; \
mpv --ao=pulse --vo=opengl --video-zoom=0 --framedrop=vo \
    --no-osc --osd-level=1 --demuxer-lavf-format=video4linux2 \
    -fs /dev/video1
Which is the highest resolution at the framerate my low spec'd gear can handle. And turning the LED OFF since that reflects if you have it pointed out a window. Sometimes I have to unplug and replug the webcam for that LED option to exist. Even after a cold boot.

If the MJPG format is supported, then vlc can stream the webcam over the network. Although it's a lot of data and 960x720 @ 5fps is the best I could do without capping out the bitrate of a 10/100 network (rpi B).
.
Thanks a lot Shadow. It's going to take me a while to digest that but I can see there's a lot of good information in there. Appreciate it.
 
Old 12-08-2016, 10:40 PM   #18
rokytnji
LQ Veteran
 
Registered: Mar 2008
Location: Waaaaay out West Texas
Distribution: antiX 23, MX 23
Posts: 7,196
Blog Entries: 21

Rep: Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491Reputation: 3491
See what happens for the hell of it

Code:
avconv -f x11grab -r 25 -s 1024x768 -i :0.0 -vcodec libx264 -threads 4 $HOME/output.avi
change the 1024X768 to match your screen resolution

Mine

http://vid751.photobucket.com/albums...ps88wpuhoq.mp4
 
1 members found this post helpful.
Old 12-09-2016, 01:18 PM   #19
erik2282
Member
 
Registered: May 2011
Location: Texas
Distribution: Primarily Deb/Ubuntu, and some CentOS
Posts: 831

Rep: Reputation: 229Reputation: 229Reputation: 229
VLC does this.
https://www.vlchelp.com/how-to-recor...-media-player/
 
Old 12-22-2016, 05:38 PM   #20
Gregg Bell
Senior Member
 
Registered: Mar 2014
Location: Illinois
Distribution: Xubuntu
Posts: 2,034

Original Poster
Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by erik2282 View Post
Thanks Erik. Since I already had VLC I tried it and I made some .mp4s and it worked really nicely. What I'm finding now is different stuff plays stuff out of sync. Like when I put the mp4 into OpenShot video it's horribly out of sync.

I guess there will be a learning curve with this stuff. Thanks for getting me started.
 
Old 12-22-2016, 08:59 PM   #21
Shadow_7
Senior Member
 
Registered: Feb 2003
Distribution: debian
Posts: 4,137
Blog Entries: 1

Rep: Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874Reputation: 874
That's what the -async 1 and -filter_complex stuff does for me, is maintain sync over a duration at the point of capture. Otherwise you have to do maths and fudge the audio track to fit the video. No matter how good you get at that artform, it is never perfect and you're always wondering if you made it better or worse.
 
1 members found this post helpful.
Old 12-23-2016, 06:06 AM   #22
fatmac
LQ Guru
 
Registered: Sep 2011
Location: Upper Hale, Surrey/Hants Border, UK
Distribution: Mainly Devuan, antiX, & Void, with Tiny Core, Fatdog, & BSD thrown in.
Posts: 5,570

Rep: Reputation: Disabled
I've been using guvcview for a few months now, so I am just checking to make sure you did select your webcam as the input for the program, as it doesn't automatically select external sources of mic or camera.
 
1 members found this post helpful.
Old 12-23-2016, 01:41 PM   #23
Gregg Bell
Senior Member
 
Registered: Mar 2014
Location: Illinois
Distribution: Xubuntu
Posts: 2,034

Original Poster
Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by Shadow_7 View Post
That's what the -async 1 and -filter_complex stuff does for me, is maintain sync over a duration at the point of capture. Otherwise you have to do maths and fudge the audio track to fit the video. No matter how good you get at that artform, it is never perfect and you're always wondering if you made it better or worse.
Thanks Shadow. I would hate to have to try to sync it manually. I got Kendive or Kenlive and that was slightly out of sync playing MP4s. So far the best is recording with VLC.
 
Old 12-23-2016, 02:08 PM   #24
Gregg Bell
Senior Member
 
Registered: Mar 2014
Location: Illinois
Distribution: Xubuntu
Posts: 2,034

Original Poster
Rep: Reputation: 176Reputation: 176
Quote:
Originally Posted by fatmac View Post
I've been using guvcview for a few months now, so I am just checking to make sure you did select your webcam as the input for the program, as it doesn't automatically select external sources of mic or camera.
Thanks fatmac. I thought I had it! I went back and checked guvcview and the camera was linked. But I couldn't get the video to work. Still captures and the audio portion of attempted video captures was fine. But it would just be a still and the audio. These were the default settings (see screenshot). I messed with them a bit but couldn't get the video to work. This looks like it would be really good.

As you can see it was making .mkv files. I was looking to see if it would make .mp4s and couldn't see a way to do it.

Any suggestions on getting this working?
Attached Thumbnails
Click image for larger version

Name:	Selection_018.png
Views:	26
Size:	60.3 KB
ID:	23820  
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Webcam Video Capture App? arfon Slackware 9 07-05-2011 08:51 AM
How to capture live Video frames from webcam Madhukar Linux - General 0 04-14-2004 07:31 AM
How to capture video frames form webcam Madhukar Linux - Software 0 04-14-2004 07:26 AM
video capture through webcam vishak Linux - General 0 03-07-2004 09:46 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 01:53 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration