LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   Record HD videos in command line (https://www.linuxquestions.org/questions/linux-software-2/record-hd-videos-in-command-line-4175563868/)

average_user 01-13-2016 03:35 PM

Record HD videos in command line
 
Is this even possible? I have Logitech Webcam C270. I tried the following ffmpeg commands but they produce poor quality videos, not HD:
Code:

ffmpeg -f video4linux2 -s 320x240 -i /dev/video0 out.mpg
ffmpeg -i /dev/video0 -vcodec copy -acodec ac3 -ab 128k -f matroska video.mkv
ffmpeg -i /dev/video0 -vcodec mjpeg -r 10 -s 640x480 file.avi

I am not an expert on video processing, codecs etc. I am not trying to shoot a professional video, just a short clip for youtube. I tried guvcview and in my opinion it produces much better quality videos than the above ffmpeg examples and although it also can be run in command line I prefer ffmpeg because it's more versatile and is installed everywhere.

jefro 01-13-2016 07:33 PM

Some notes maybe.

Start with listing the modes. Then maybe try their example. ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -i /dev/video0 output.mkv

"
Linux

Uses the video4linux2 (or simply v4l2) input device to capture live input such as from a webcam. See the v4l2 input device documentation for more information.
List devices

To list the supported, connected capture devices you can use the v4l-ctl tool. This example shows two connected webcams: /dev/video0 and /dev/video1.

$ v4l2-ctl --list-devices
USB2.0 PC CAMERA (usb-0000:00:1d.7-1):
/dev/video1

UVC Camera (046d:0819) (usb-0000:00:1d.7-2):
/dev/video0

List device capabilities

To list available formats (supported pixel formats, video formats, and frame sizes) for a particular input device:

$ ffmpeg -f v4l2 -list_formats all -i /dev/video0

[video4linux2,v4l2 @ 0xf07d80] Raw : yuyv422 : YUV 4:2:2 (YUYV) : 640x480 160x120 176x144 320x176 320x240 352x288 432x240 544x288 640x360
[video4linux2,v4l2 @ 0xf07d80] Compressed: mjpeg : MJPEG : 640x480 160x120 176x144 320x176 320x240 352x288 432x240 544x288 640x360

Alternatively you could use v4l2-ctl --list-formats-ext to list available formats.
Encoding example

Example to encode video from /dev/video0:

ffmpeg -f v4l2 -framerate 25 -video_size 640x480 -i /dev/video0 output.mkv

Adjusting camera functions

Brightness, zoom, focus, etc, can be adjusted with v4l2-ctl. Display all controls and their menus:

v4l2-ctl -L

Then adjust the value:

v4l2-ctl -c <option>=<value>
"

https://trac.ffmpeg.org/wiki/Capture/Webcam


All times are GMT -5. The time now is 07:59 PM.