1

I've been struggling with a ffmpeg-related issue for a few days now. What I am trying to accomplish is to grab AV signal from a single input (/dev/video0), then save it into two files simultaneously.

  • Output no. 1: raw AVI file, for further editing
  • Output no. 2: preview mp4 file, to work as a preview within an embedded VideoJS player on an webapp.

Here's my command:

ffmpeg -f v4l2 -standard PAL -i /dev/video0 -f alsa -thread_queue_size 512 -i hw:0,0 -preset superfast -crf 25 -r 25 -aspect 4:3 -acodec libmp3lame -b:v 6M -b:a 128k -channels 2 -ar 48000 /vids/vid1.avi | -acodec libmp3lame  -b:v 500k -b:a 128k -channels 2 -ar 48000 -y /opt/lampp/htdocs/preview.mp4

The command above doesn't seem to work for me. Where have I gone wrong?

2
  • *doesn't seem to work * --> what's wrong?
    – Gyan
    Feb 9, 2021 at 15:20
  • Using this command makes output 1 generate nice and smooth, while output 2 doesn't generate at all.
    – Radek
    Feb 9, 2021 at 15:34

1 Answer 1

1

Remove the pipe character.

ffmpeg -f v4l2 -standard PAL -i /dev/video0 -f alsa -thread_queue_size 512 -i hw:0,0 -preset superfast -crf 25 -r 25 -aspect 4:3 -acodec libmp3lame -b:v 6M -b:a 128k -ac 2 -ar 48000 /vids/vid1.avi -b:v 500k -b:a 128k -ac 2 -ar 48000 -y /opt/lampp/htdocs/preview.mp4

(mp3 is not standard in MP4 so let ffmpeg pick the default audio codec)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.