Is there a way one can compress captured video input before saving to file? I have raspberry pi that I am using to record youtube videos. 1-2 min video takes over a Gb of space. I cant compress the recorded file because the pi does not have enough space to record the initial video. Is there a way using ffmpeg I can compress my webcam video directly after its captured before saving the file versus waiting until I am done recording then compressing the saved file?

I'm using

ffmpeg \ -f v4l2 \ -thread_queue_size 5000 -framerate 25 -video_size 640x480 -i /dev/video0 -y -c:v libx264 ~/Desktop/ffmpegTesting/money.mp4 \ -thread_queue_size 5000 -f alsa -ac 1 -ar 44100 -i hw:1,0 -t 30 -c:v copy -c:a ~/Desktop/ffmpegTesting/money.mp4 \

  • Ive managed to compress before saving but the audio is disapearring now :( – z Eyeland Feb 9 '19 at 20:37
  • to be more exact. The audio disappears around the 10-11 second mark in the video – z Eyeland Feb 9 '19 at 20:38
  • Syntax is malformed, it should be: ffmpeg -f v4l2 -thread_queue_size 5000 -framerate 25 -video_size 640x480 -i /dev/video0 -thread_queue_size 5000 -f alsa -i hw:1,0 -c:v libx264 -ac 1 -ar 44100 -c:a aac -y ~/Desktop/ffmpegTesting/money.mp4 – Gyan Feb 9 '19 at 20:53
  • The error I am getting now is : cannot set channel count to 2 (Invalid argument) hw:1,0: Input/output error – z Eyeland Feb 9 '19 at 20:59
  • Ok i fixed problem by setting hw:1,0 to plughw:1,0 – z Eyeland Feb 9 '19 at 21:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.