<p>To pipe to x264 and encode to AAC file in the same command, use</p>

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

<p>Then you can mux it via</p>

<pre><code>mp4box -add v.mp4 -add v.aac -new va.mp4
</code></pre>

CC BY-SA 3.0
2017-01-18T15:17:15.057Z
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
CC BY-SA 3.0
2017-01-18T15:37:40.963Z
Show the full console output of the command and also ffprobe of the mp4box output.
Gyan
CC BY-SA 3.0
2017-01-18T16:08:43.880Z
ffmpeg -i DC.mp4 -map v -f yuv4mpegpipe - -c:a aac audio.aac  | x264 --demuxer y4m --crf 18 --output "out.mp4" -    /////

Screenshot 1 : https://postimg.org/image/xelash2sn/

Screenshot 2 : https://postimg.org/image/ps6rpp8xt/      ///////    I didn't use mp4box yet.
AL-KOON
CC BY-SA 3.0
2017-01-18T16:18:30.340Z
What does `ffprobe audio.aac` and `ffprobe -show_entries stream=duration dc.mp4` say?
Gyan
CC BY-SA 3.0
2017-01-18T20:17:33.020Z
I think the problem with input file video test .. anyway this is Video input : https://postimg.org/image/s5z9zwqb5/

audio output : https://postimg.org/image/3o76c0nqp/

// I just upload input Video https://www.solidfiles.com/v/GDRWZBkXxXxBX
AL-KOON
CC BY-SA 3.0
2017-01-19T11:22:01.153Z
When I used avs to import video , still same problem!
AL-KOON
CC BY-SA 3.0
2017-01-18T14:39:28.353Z
2017-01-18T14:39:28.353Z
Gyan
<p>I just want to know if it's possible to encode audio &amp; video at the
 same time by FFmpeg</p>

<p>-c:a libfaac  for  audio
 &amp;
 x264.exe for video.</p>

<p>and any example! </p>

CC BY-SA 3.0
2017-01-18T12:26:42.413Z
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
CC BY-SA 3.0
2017-01-18T13:24:51.880Z
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
CC BY-SA 3.0
2017-01-18T13:35:45.093Z
Something like    /   
ffmpeg -i test.avi -c:a libfaac -b:a 128k | x264 --crf 18 -o test.mp4 -
AL-KOON
CC BY-SA 3.0
2017-01-18T13:50:12.997Z
You don't want to use libx264 in ffmpeg?
Gyan
CC BY-SA 3.0
2017-01-18T13:59:22.320Z
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
<ffmpeg><x264>
Multiple FFmpeg input & output
AL-KOON
# Multiple FFmpeg input & output

(Asked by: username_0 on 2017-01-18)

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!

**Tags:** ffmpeg, x264

> **Comments:**
> **username_1**: 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.  
> **username_0**: 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.  
> **username_0**: Something like    /    ffmpeg -i test.avi -c:a libfaac -b:a 128k | x264 --crf 18 -o test.mp4 -  
> **username_1**: You don't want to use libx264 in ffmpeg?  
> **username_0**: 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"  

---

## 1 answers

### Answer by username_1 on 2017-01-18. Score: 1

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

> **Comments:**
> **username_0**: 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 ?!  
> **username_1**: Show the full console output of the command and also ffprobe of the mp4box output.  
> **username_0**: ffmpeg -i DC.mp4 -map v -f yuv4mpegpipe - -c:a aac audio.aac  | x264 --demuxer y4m --crf 18 --output "out.mp4" -    /////  Screenshot 1 : https://postimg.org/image/xelash2sn/  Screenshot 2 : https://postimg.org/image/ps6rpp8xt/      ///////    I didn't use mp4box yet.  
> **username_1**: What does `ffprobe audio.aac` and `ffprobe -show_entries stream=duration dc.mp4` say?  
> **username_0**: I think the problem with input file video test .. anyway this is Video input : https://postimg.org/image/s5z9zwqb5/  audio output : https://postimg.org/image/3o76c0nqp/  // I just upload input Video https://www.solidfiles.com/v/GDRWZBkXxXxBX  
> **username_0**: When I used avs to import video , still same problem!  

---

