I just want to know if it's possible to encode audio & video at the same time by FFmpeg

-c:a libfaac for audio & x264.exe for video.

and any example!

  • Not clear on what you are looking for, but in general, yes. It is very much possible to encode audio and video at the same time, muxing the results into the same file, or separate files. – Gyan Jan 18 '17 at 12:26
  • Thanx Mulvya. What I want exactly is how to use x264.exe encoder & libfaac (aac) to encode video and audio at the same time by FFmpeg. – AL-KOON Jan 18 '17 at 13:24
  • Something like / ffmpeg -i test.avi -c:a libfaac -b:a 128k | x264 --crf 18 -o test.mp4 - – AL-KOON Jan 18 '17 at 13:35
  • You don't want to use libx264 in ffmpeg? – Gyan Jan 18 '17 at 13:50
  • No, I want to use x264-10bit which come with FFmpeg build. I tried this :( ffmpeg -i DC_MV.mp4 | x264.exe --crf 18 --output "test.mp4") but it says " At least one output file must specified" – AL-KOON Jan 18 '17 at 13:59

To pipe to x264 and encode to AAC file in the same command, use

ffmpeg -i in.mp4 -map v -f yuv4mpegpipe - -map a -c:a libfaac v.aac | x264 --demuxer y4m --crf 18 --output "v.mp4" -

Then you can mux it via

mp4box -add v.mp4 -add v.aac -new va.mp4
  • Thank you very much, but I got problem, the time of audio isn't like video , video time is 1:40 and audio time is 1;25 , for output, Why ?! – AL-KOON Jan 18 '17 at 15:17
  • Show the full console output of the command and also ffprobe of the mp4box output. – Gyan Jan 18 '17 at 15:37
  • ffmpeg -i DC.mp4 -map v -f yuv4mpegpipe - -c:a aac audio.aac | x264 --demuxer y4m --crf 18 --output "out.mp4" - ///// Screenshot 1 : postimg.org/image/xelash2sn Screenshot 2 : postimg.org/image/ps6rpp8xt /////// I didn't use mp4box yet. – AL-KOON Jan 18 '17 at 16:08
  • What does ffprobe audio.aac and ffprobe -show_entries stream=duration dc.mp4 say? – Gyan Jan 18 '17 at 16:18
  • I think the problem with input file video test .. anyway this is Video input : postimg.org/image/s5z9zwqb5 audio output : postimg.org/image/3o76c0nqp // I just upload input Video solidfiles.com/v/GDRWZBkXxXxBX – AL-KOON Jan 18 '17 at 20:17

Your Answer

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

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