Answers.Body: <p>This might be a bit late but if it helps I've got a working PowerShell script that I use to create chapterized m4b files which I am assuming you are trying to do since you list m4b. </p>
  
  <p>I use the following command for mp3 format files </p>
  
  <pre><code>ffmpeg -f concat -safe 0 -i list.txt -vn -y -b:a 64k -acodec aac -ac 2 temp.m4a
  </code></pre>
  
  <p>If its already in AAC format (MP4) it's even simpler</p>
  
  <pre><code>ffmpeg -f concat -safe 0 -i list.txt -c copy temp.m4a
  </code></pre>
  
  <p>list.txt is a simple list of all the files to combine into a single m4a, 1 file per line. I found this to work much better than trying to do it using INPUT and listing all the files on the command line. That method always seemed to break for me.</p>
  
  <p>Once this is done you can inject the chapters and rename to m4b all in a single command line. </p>
  
  <pre><code>ffmpeg -i "ffmetadata.txt" -i "temp.m4a" -map_metadata 1 -codec copy "$artist - $albumSanitized.m4b"
  </code></pre>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-12T02:40:35.313Z
Answers.Text: What does the ffmetadata.txt file look like? I'm trying to find out what to put in that file but my searches are coming up short.
Answers.UserDisplayName: ian
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2021-01-12T02:47:34.170Z
Answers.Text: Of course, I found it within minutes of asking this (o_º) Searching for "map_metadata" was the key. There's an example [here](https://ffmpeg.org/ffmpeg-formats.html#Metadata-1), found via [this SO answer](https://stackoverflow.com/a/47415805/335847). Wouldn't have found it without your answer, thanks!
Answers.UserDisplayName: ian
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2020-01-20T15:48:25.907Z
Answers.LastActivityDate: 2020-01-20T15:48:25.907Z
Answers.UserDisplayName: CM42
Answers.Body: <p>To do this with just ffmpeg, try using <code>-vn</code> to not include video on output:</p>
  
  <pre><code>ffmpeg -i INPUT -c:a aac -c:b 128k -vn -f mp4 OUTPUT.m4b
  </code></pre>
  
  <p>This outputs just the audio of the mp4 in an m4b file.</p>
  
  <p>Here's stream selection in the ffmpeg documentation.</p>
  
  <p><a href="https://ffmpeg.org/ffmpeg.html#Stream-selection" rel="nofollow noreferrer">Stream Selection</a></p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-22T19:12:41.437Z
Answers.Text: Since I'm using this in code I had to make some modifications just to be able to use it.
Answers.UserDisplayName: Don6558
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-22T19:30:27.843Z
Answers.Text: Since I'm using this in code I had to make some modifications just to be able to use it. It did not work until I removed the -f and -c:a aac commands. The working line for me so far is:  ffmpeg -i input -ar 22050 -b:a 56k -vn Output . This outputs a very small file of the type I specified in Output. I have yet to figure out why this iteration works and yours won't. Does it have to do with expecting multiple files/streams? I will continue to study the ffmpeg help document. Thank you very much for your help. You gave me the jumping off point I needed to start figuring this out.
Answers.UserDisplayName: Don6558
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-23T03:17:58.130Z
Answers.Text: @Don6558 Interesting, I'm certainliy not familiar with using ffmpeg in vb.net but -c:a aac is specifying the audio codec as aac which you may not need and -f mp4 is forcing the output format to the mp4/m4a/m4v family of formats.
  
  Glad I could help and at least point you in the right direction.
Answers.UserDisplayName: Naqros
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2019-07-22T02:29:21.307Z
Answers.LastActivityDate: 2019-07-22T02:29:21.307Z
Answers.UserDisplayName: Naqros
Body: <p>Can mp4 audio/video be converted to m4b using ffmpeg command line tool.(in vb.net)</p>
  
  <p>I've spent the last few days trying various query combinations to find an answer but to no avail.</p>
  
  <p>What I have found is that m4a/m4b is the same container as mp4, the difference being m4a/m4b contains no video signal.</p>
  
  <p>When I tried to convert mp4 directly to m4b, I ended up with an output m4b much larger than the original mp4 and the m4b still contained video.</p>
  
  <p>I am using a code example from CodeProject. I am able to convert from mp4 to mp3 and from mp3 to m4b but mp4 to m4b still contains the video portion of the file.</p>
  
  <p>So, can ffmpeg input mp4 and convert it to m4b or m4a directly or is it a 2 step process, mp4 to mp3 then mp3 to m4b? If it is a 1 step process, could you point me in the direction of the documentation so I can learn how to do it.</p>
  
  <p>Thanks</p>
  
Tags: <ffmpeg><programming>
Title: Can ffmpeg input mp4 and convert it to m4b or m4a?
UserDisplayName: Don6558
ThreadText: # Can ffmpeg input mp4 and convert it to m4b or m4a?
  
  (Asked by: username_0 on 2019-07-21)
  
  Can mp4 audio/video be converted to m4b using ffmpeg command line tool.(in vb.net)
  
  I've spent the last few days trying various query combinations to find an answer but to no avail.
  
  What I have found is that m4a/m4b is the same container as mp4, the difference being m4a/m4b contains no video signal.
  
  When I tried to convert mp4 directly to m4b, I ended up with an output m4b much larger than the original mp4 and the m4b still contained video.
  
  I am using a code example from CodeProject. I am able to convert from mp4 to mp3 and from mp3 to m4b but mp4 to m4b still contains the video portion of the file.
  
  So, can ffmpeg input mp4 and convert it to m4b or m4a directly or is it a 2 step process, mp4 to mp3 then mp3 to m4b? If it is a 1 step process, could you point me in the direction of the documentation so I can learn how to do it.
  
  Thanks
  
  **Tags:** ffmpeg, programming
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_1 on 2020-01-20. Score: 1
  
  This might be a bit late but if it helps I've got a working PowerShell script that I use to create chapterized m4b files which I am assuming you are trying to do since you list m4b.
  
  I use the following command for mp3 format files
  
  ```
  ffmpeg -f concat -safe 0 -i list.txt -vn -y -b:a 64k -acodec aac -ac 2 temp.m4a
  
  ```
  
  If its already in AAC format (MP4) it's even simpler
  
  ```
  ffmpeg -f concat -safe 0 -i list.txt -c copy temp.m4a
  
  ```
  
  list.txt is a simple list of all the files to combine into a single m4a, 1 file per line. I found this to work much better than trying to do it using INPUT and listing all the files on the command line. That method always seemed to break for me.
  
  Once this is done you can inject the chapters and rename to m4b all in a single command line.
  
  ```
  ffmpeg -i "ffmetadata.txt" -i "temp.m4a" -map_metadata 1 -codec copy "$artist - $albumSanitized.m4b"
  
  ```
  
  > **Comments:**
  > **username_2**: What does the ffmetadata.txt file look like? I'm trying to find out what to put in that file but my searches are coming up short.  
  > **username_2**: Of course, I found it within minutes of asking this (o_º) Searching for "map_metadata" was the key. There's an example [here](https://ffmpeg.org/ffmpeg-formats.html#Metadata-1), found via [this SO answer](https://stackoverflow.com/a/47415805/335847). Wouldn't have found it without your answer, thanks!  
  
  ---
  
  ### Answer by username_3 on 2019-07-22. Score: 0
  
  To do this with just ffmpeg, try using `-vn` to not include video on output:
  
  ```
  ffmpeg -i INPUT -c:a aac -c:b 128k -vn -f mp4 OUTPUT.m4b
  
  ```
  
  This outputs just the audio of the mp4 in an m4b file.
  
  Here's stream selection in the ffmpeg documentation.
  
  [Stream Selection](https://ffmpeg.org/ffmpeg.html#Stream-selection)
  
  > **Comments:**
  > **username_0**: Since I'm using this in code I had to make some modifications just to be able to use it.  
  > **username_0**: Since I'm using this in code I had to make some modifications just to be able to use it. It did not work until I removed the -f and -c:a aac commands. The working line for me so far is:  ffmpeg -i input -ar 22050 -b:a 56k -vn Output . This outputs a very small file of the type I specified in Output. I have yet to figure out why this iteration works and yours won't. Does it have to do with expecting multiple files/streams? I will continue to study the ffmpeg help document. Thank you very much for your help. You gave me the jumping off point I needed to start figuring this out.  
  > **username_3**: @username_0 Interesting, I'm certainliy not familiar with using ffmpeg in vb.net but -c:a aac is specifying the audio codec as aac which you may not need and -f mp4 is forcing the output format to the mp4/m4a/m4v family of formats.  Glad I could help and at least point you in the right direction.  
  
  ---
  
  