1

The following command

ffmpeg -f alsa -ac 2 -i plughw:0,0 -f video4linux2 -s vga -i /dev/video0 -f ogg - > video.mp4

Does not produce a .mp4 video.

I want to replace -f ogg with -f <mp4 format> where <mp4 format> is the right format to generate a video in .mp4.

To make thinks clear, I want to have:

# file video.mp4
video.mp4: ISO Media, MP4 Base Media v1 [IS0 14496-12:2003]

PS: I want to use pipe, since it is used for other pipe operations

Thomas
  • 6,242
  • 8
  • 26
  • 32
j1088099.mvrht.com.
  • 2,903
  • 3
  • 13
  • 20
  • @Thomas I mistakenly voted against your edit, didn't notice you fixed the code-formatting. Sorry about that! As long as a third person shows up and votes for it, though, it'll be approved anyway. Just want to leave an explanation in case the site mentions the no vote... – derobert Dec 12 '16 at 21:52

1 Answers1

3

ffmpeg -formats will list all of them, its sounds like you're looking for (surprisingly enough) -f mp4.

Note that depending on your V4L capture device's format, you may need to specify encoding to an MPEG-4 compatible audio (-codec:a / -acodec) and video codec (-codec:v / -vcodec).

derobert
  • 107,579
  • 20
  • 231
  • 279
  • Thanks. Can you however briefly explain how the right codec is found? –  j1088099.mvrht.com. Dec 13 '16 at 11:21
  • @j1088099.mvrht.com. There aren't really *correct* ones, some are not supported inside MP4 (and similarly other container formats only support certain codecs). But probably you want H.264 (`-c:v libx264`) and one of several audio codecs; https://trac.ffmpeg.org/wiki/Encode/HighQualityAudio has a list (by container format). – derobert Dec 13 '16 at 17:48