YaK:: linux video capture notes | [Changes] [Calendar] [Search] [Index] [PhotoTags] |
ffmpeg -thread_queue_size 512 -r 16 -i /dev/video2 -f alsa -thread_queue_size 512 -i hw:1,0 -channels 2 -ar 8000 /tmp/v36.mp4
kdenlive project.kdenlive
===========================
https://www.reddit.com/r/kdenlive/comments/d9218u/using_mp4_files_on_linux_kdenlive/
Create a New Project, Setup your Default video profile and project folder, Hit ok and after that, you should be able to find the folder your .mp4 files are in KDenLive will find them if you direct the software to the correct folder. What I did was create a folder that said KDenLive and move my video files there and then I let Kdenlive create its own project folder within my main directory within the video folder.
Also, my folder is named Kdenlive Projects and it's also inside the main directory video folder with the folder that Kdenlive created for when I save my projects.
============================================================
web page says
https://ubuntuforums.org/showthread.php?t=2354678
1.1 SET SOUND INPUT DEVICE
Set analogue input device usb hub TV etc (if it concerns a tv to usb input) in your sound settings.
1.2 CHECK VIDEO AND AUDIO INPUT - SEVERAL POSSIBILITIES
'sudo apt-get install v4l-utils' and use the command 'v4l2-ctl --list-devices' to check video input,
and/or:
VLC, Media record, select video (e.g. /dev/video0) and sound (e.g. hw:1,0) under 'Video Camera' for the correct TV system (e.g. PAL) and test/play the result.
and/or:
Check audio with the command 'arecord -l' (most important).
2. CAPTURE/RECORD
These are some codes that work for me on several systems (older and newer) and this after several try-outs. Input: EasyCap stick (tv/recorder-scart-OUT-composite-EasyCap-long-usb-or-composite-or-s-video-cable-to-usb-port-laptop / PAL TV).
Paste the given code line in your terminal. Interrupt/save with 'q'. Reinsert with 'Arrow Up'. Posssibly change the file number or name in case of new file.
The first take will often give a '0 fps' message in your terminal. This disappears from the second take. No picture or no sound often means you're not using the right video4linux or alsa number (See: PREPARATION.)
2.1 MPEG4-PART10 (H264, X264)
Code: ffmpeg -f v4l2 -standard PAL -thread_queue_size 512 -i /dev/video0 -f alsa -thread_queue_size 512 -i hw:0,0 -vcodec libx264 -preset superfast -crf 25 -s 640x480 -r 25 -aspect 16:9 -acodec libmp3lame -b:a 128k -channels 2 -ar 48000 out_0001.mkv The v4l2 'standard' is important for the right picture scaling. PAL (Europe) or NTSC (U.S. = v4l Default) or SECAM (France) most often.
mp4-outputcontainer can be used as well of course (Eventhough, '.mkv' = more 'flexible'). Best preset: 'superfast' seems to work in most cases. Otherwise: 'veryfast'. In case of bad, stuttering reception: 'ultrafast' (but, less quality/less compression). All the possibilities: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow, placebo.
I've used mp3lame after aac started stuttering. Most used values: 44100 or 48000 hz. I try to keep the original hz audio frequency of the input as much as possible. Of course keeping the original input audio with '-acodec copy' is also an option. Recoding the audio afterwards doesn't take too much time.
'-thread_queue_size n': when placed twice, after 'v4l2' and after 'alsa' (whatever the used codec), it deals with the possible repeatedly occurring message 'ALSA buffer x-run' and bad sound recording. After doing this the message appeared once, on an older system, then disappeared with a smooth recording of audio as a result. Common settings: 512, 1024, 2048.
'-crf': best quality-filesize results between 20 and 28.
2.2 MPEG4-PART2 (H263, XVID)
I prefer this codec (sorry! - whatever 'they' say) as video cutting afterwards, with ffmpeg or more easily with avidemux, works better than in case of mpeg4-part10. 'mpeg4' or 'mpeg4 -vtag xvid' or 'libxvid' (the last one sometimes gives message of not present library. Just 'mpeg4' is maybe the safest.).
2.2.1 Constant bitrate
Code: ffmpeg -f v4l2 -standard PAL -thread_queue_size 512 -i /dev/video0 -f alsa -thread_queue_size 512 -i hw:0,0 -vcodec mpeg4 -b:v 1800k -s 640x480 -r 25 -aspect 16:9 -acodec libmp3lame -b:a 128k -channels 2 -ar 48000 out_0001.mkv 2.2.2 Variable bitrate
Code: ffmpeg -f v4l2 -standard PAL -thread_queue_size 512 -i /dev/video0 -f alsa -thread_queue_size 512 -i hw:0,0 -vcodec mpeg4 -q:v 4 -s 640x480 -r 25 -aspect 16:9 -acodec libmp3lame -q:a 7 -channels 2 out_0001.mkv Bitrate or qscale = personal choice (see documentation). Variable bitrate should give slightly better quality but it sometimes 'fluctuates' ('bitrate jumps') so much that you get uncertain file size and quality. Other settings: see FFmpeg Documentation.
No video - audio syncproblems with above codes.
It can be challenging to try to avoid sudden black frames. Especially in longer recordings. This is stronly dependent on the hardware state at the moment of capturing.
Last edited by xinuzi; May 3rd, 2017 at 03:21 AM.
(last modified 2024-08-24) [Login] |