Answers.Body: <p>I asked on the ffmpeg-users mailing list, and it was suggested that I add <code>-brand 3gp6</code> to my encoding command.  This achieved the result in <code>mediainfo</code> that I was looking for.  However, it remains to be seen whether this really reaches the same compatibility with older hardware that YouTube's 3GP files have.  I don't have any old hardware to test with, lol.  Anyway, as far as I'm concerned, problem solved for now!</p>
  
  <p>If anyone is interested, here is the command I ended up with for reproducing YouTube's "Format 36", which is a 360x180 3GP video with about 230 Kbps overall bitrate:</p>
  
  <pre><code>ffmpeg -i input-file.mov -vcodec mpeg4 -s 320x180 -qscale:v 20 -brand 3gp6 \
      -vf 'scale=iw*sar:ih,pad=max(iw\,ih*(16/9)):ow/(16/9):(ow-iw)/2:(oh-ih)/2' \
      -acodec libfaac -ar 22050 -ac 1 -qscale:a 70 output-file.3gp
  </code></pre>
  
  <p>And here is what I came up with for reproducing its "Format 17", which is a 176x144 3GP video with about 82 Kbps overall bitrate:</p>
  
  <pre><code>ffmpeg -i input-file.mov -vcodec mpeg4 -s 176x144 -qscale:v 12 -r 10 -level 8 -brand 3gp6 \
      -vf 'scale=iw*sar:ih,pad=max(iw\,ih*(11/9)):ow/(11/9):(ow-iw)/2:(oh-ih)/2' \
      acodec libfaac -ar 22050 -ac 1 -qscale:a 45 output-file.3gp
  </code></pre>
  
  <p>In case you're wondering, that massive "-vf" argument automagically detects mismatches in aspect ratios between the input and output, and boxes the output if they differ.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-25T18:41:23.180Z
Answers.LastActivityDate: 2014-09-25T19:04:43.330Z
Answers.LastEditDate: 2014-09-25T19:04:43.330Z
Answers.UserDisplayName: curtisdf
Answers.Body: <p>Why would you want your videos in the .3gp container to begin with? Its a very irrelevant format nowadays, there is practically no device that supports the 3gp container but not MP4 at the same time. Its nothing but a close derivative of MP4, they are very similar container formats holding the same codec. If you want to support a lot of devices using h264 in the mp4 container opens your website up to the majority of mobile an desktop devices, in addition vp8/webm offers compatibility to open source software that can't afford h264 license or doesn't want to use h264. With these two formats you are covering every relevant market.</p>
  
  <p><a href="http://caniuse.com/#feat=mpeg4" rel="nofollow">http://caniuse.com/#feat=mpeg4</a></p>
  
  <p><a href="http://caniuse.com/#feat=webm" rel="nofollow">http://caniuse.com/#feat=webm</a></p>
  
  <p>3gp is a depricated format for legacy phones, long before the Android and iOS era when YouTube was new and started to add a bit of mobile support and its nearly identical with MP4, some manufactures even name their 3gp files with the .mp4 extension (<a href="http://en.wikipedia.org/wiki/3GP_and_3G2#Technical_details" rel="nofollow">wiki</a>)</p>
  
  <p>Also note that having your files have the same meta information as those from YouTube is not an indicator if they are compatible or not, YouTube uses a different encoder than you and the encoder will write different information than x264 in ffmpeg. If your file meets the specs of a certain format than its compatible, easy as that.
  If you want to go sure you don't use any fancy format features just use a low profile (e.g. baseline in the case of h264) to ensure compatibility with virtually any device, the lower the profile the less features are allowed.</p>
  
  <p>If you REALLY need to use 3gp you can specify the container with the option <code>-f 3gp</code>. Using the BaseLine 1 profile is absolutely suffice.
  Using a ffmpeg commandline like the following will get you what need:</p>
  
  <pre><code>ffmpeg -i input.mp4 -vf scale=320:240 -vcodec mpeg4 -acodec aac -strict -2 -f
  3gp output.3gp
  </code></pre>
  
  <p>Note the usage of <code>mpeg4</code> instead of libx264. The <code>mpeg4</code> encoder is the Mpeg4 Part 2 codec also known as h263. Again, extremely few devices nowadays do not support h264 and I can only advice to support h263 in the 3gp container when you are in dire need to do so or have an extremely large user base that ranks in the tens of millions of users.</p>
  
  <p>Having 3gp6 instead of 3gp4 is irrelevant, you are targeting old devices so using the newest version of the standard doesn't make much sense. FFmpeg will use the 3gp6 container only when using the also newer codec h264 which release 6 is also meant for.</p>
  
  <p>Here and excerpt from the 3gpp v6 standard:</p>
  
  <pre><code>Specific MBMS Rel-6 application codecs are introduced, like for example audio codecs Extended AMR-WB (AMR-WB+), Enhanced aacPlus and video codec H.264/AVC.
  </code></pre>
  
  <p>So unless you use h264, there is no need for using Release 6 and you can stick with Release 4 without running into any issues.
  The opposite is actually the case, the older the version the more old devices you will support.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-14T18:38:23.473Z
Answers.Text: I'm not sure why YouTube still offers 3GP formats, but since they still do in this late year of 2014, I'm guessing it's for a good reason.  They target not just the US where smarphones are abundant. They also target everywhere else, like 3rd-world countries where supposedly "dumb" phones offer all the Internet people can get. Maybe this is YouTube's purpose in still carrying 3GP.  My site also targets the world audience.  And I'm not just doing 3GP. I'm also doing MP3, WEBM, and FLV like YouTube does. It's just the 3GP part I'm stuck on.
Answers.UserDisplayName: curtisdf
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-14T18:46:50.800Z
Answers.Text: The only reason is for really old phones, they just have to remux their mp4 encodes so its barley any extra work, wouldn't be suprised if they not just change a few bytes in the header.
  There is a very little percentage of phones that supports 3gp but not mp4.
  What is your reason for that huge compatability, does you audience mostly consist of legacy device users?
Answers.UserDisplayName: timonsku
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-14T18:54:21.663Z
Answers.Text: It's in the name of reaching the widest possible audience. But I recognize that the last X percent may take too much effort to reach. Still, if there's an "easy" way to coerce ffmpeg to give me 3gp6 files using MPEG-4 Visual and Simple@L1, I'd like to try it.
Answers.UserDisplayName: curtisdf
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-14T19:16:10.987Z
Answers.Text: I added info on how to encode your videos like that but again, you should definitely see if thats really worth it. It's like doing optimizations for IE6 and 7.
Answers.UserDisplayName: timonsku
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-14T20:13:24.273Z
Answers.Text: Another edit regarding 3gpp v6 vs v4
Answers.UserDisplayName: timonsku
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2014-09-14T17:45:32.020Z
Answers.LastActivityDate: 2014-09-14T20:19:10.257Z
Answers.LastEditDate: 2014-09-14T20:19:10.257Z
Answers.UserDisplayName: timonsku
Body: <p>I'm building a new media site and I'm taking cues from YouTube for which video file formats I should offer for widespread usability among mobile and desktop clients.  I'm doing all transcoding using <code>ffmpeg</code>.  My trouble is that YouTube's .3gp files have a Codec ID of "3gp6", a Video Format of "MPEG-4 Visual", and a Video Format Profile of "Simple@L1" (using <code>mediainfo</code> to interrogate the files.) I can't figure out which <code>ffmpeg</code> settings I can use to reproduce this.</p>
  
  <p>If I use <code>-vcodec libx264 -profile:v baseline -level 1</code> in my <code>ffmpeg</code> command, then the file comes out with the right Codec ID, but the Video Format is "AVC" and the Profile is "Baseline@L1.0".</p>
  
  <p>Alternately, if I use <code>-vcodec mpeg4 -profile 0 -level 1</code>, then the Video Format and Profile are correct, but the Codec ID is "3gp4" instead of "3gp6".</p>
  
  <p>So my question is, how can I use <code>ffmpeg</code> to arrive at a Codec ID of 3gp6 along with a format of MPEG-4 Visual and a profile of Simple@L1?  I've been unsuccessfully Googling and experimenting on this for hours.</p>
  
Tags: <ffmpeg><youtube>
Title: YouTube 3gp encoding settings
UserDisplayName: curtisdf
ThreadText: # YouTube 3gp encoding settings
  
  (Asked by: username_0 on 2014-09-14)
  
  I'm building a new media site and I'm taking cues from YouTube for which video file formats I should offer for widespread usability among mobile and desktop clients. I'm doing all transcoding using `ffmpeg`. My trouble is that YouTube's .3gp files have a Codec ID of "3gp6", a Video Format of "MPEG-4 Visual", and a Video Format Profile of "Simple@L1" (using `mediainfo` to interrogate the files.) I can't figure out which `ffmpeg` settings I can use to reproduce this.
  
  If I use `-vcodec libx264 -profile:v baseline -level 1` in my `ffmpeg` command, then the file comes out with the right Codec ID, but the Video Format is "AVC" and the Profile is "Baseline@L1.0".
  
  Alternately, if I use `-vcodec mpeg4 -profile 0 -level 1`, then the Video Format and Profile are correct, but the Codec ID is "3gp4" instead of "3gp6".
  
  So my question is, how can I use `ffmpeg` to arrive at a Codec ID of 3gp6 along with a format of MPEG-4 Visual and a profile of Simple@L1? I've been unsuccessfully Googling and experimenting on this for hours.
  
  **Tags:** ffmpeg, youtube
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_0 on 2014-09-25. Score: 1 | Accepted answer
  
  I asked on the ffmpeg-users mailing list, and it was suggested that I add `-brand 3gp6` to my encoding command. This achieved the result in `mediainfo` that I was looking for. However, it remains to be seen whether this really reaches the same compatibility with older hardware that YouTube's 3GP files have. I don't have any old hardware to test with, lol. Anyway, as far as I'm concerned, problem solved for now!
  
  If anyone is interested, here is the command I ended up with for reproducing YouTube's "Format 36", which is a 360x180 3GP video with about 230 Kbps overall bitrate:
  
  ```
  ffmpeg -i input-file.mov -vcodec mpeg4 -s 320x180 -qscale:v 20 -brand 3gp6 \
      -vf 'scale=iw*sar:ih,pad=max(iw\,ih*(16/9)):ow/(16/9):(ow-iw)/2:(oh-ih)/2' \
      -acodec libfaac -ar 22050 -ac 1 -qscale:a 70 output-file.3gp
  
  ```
  
  And here is what I came up with for reproducing its "Format 17", which is a 176x144 3GP video with about 82 Kbps overall bitrate:
  
  ```
  ffmpeg -i input-file.mov -vcodec mpeg4 -s 176x144 -qscale:v 12 -r 10 -level 8 -brand 3gp6 \
      -vf 'scale=iw*sar:ih,pad=max(iw\,ih*(11/9)):ow/(11/9):(ow-iw)/2:(oh-ih)/2' \
      acodec libfaac -ar 22050 -ac 1 -qscale:a 45 output-file.3gp
  
  ```
  
  In case you're wondering, that massive "-vf" argument automagically detects mismatches in aspect ratios between the input and output, and boxes the output if they differ.
  
  
  ---
  
  ### Answer by username_1 on 2014-09-14. Score: 4
  
  Why would you want your videos in the .3gp container to begin with? Its a very irrelevant format nowadays, there is practically no device that supports the 3gp container but not MP4 at the same time. Its nothing but a close derivative of MP4, they are very similar container formats holding the same codec. If you want to support a lot of devices using h264 in the mp4 container opens your website up to the majority of mobile an desktop devices, in addition vp8/webm offers compatibility to open source software that can't afford h264 license or doesn't want to use h264. With these two formats you are covering every relevant market.
  
  <http://caniuse.com/#feat=mpeg4>
  
  <http://caniuse.com/#feat=webm>
  
  3gp is a depricated format for legacy phones, long before the Android and iOS era when YouTube was new and started to add a bit of mobile support and its nearly identical with MP4, some manufactures even name their 3gp files with the .mp4 extension ([wiki](http://en.wikipedia.org/wiki/3GP_and_3G2#Technical_details))
  
  Also note that having your files have the same meta information as those from YouTube is not an indicator if they are compatible or not, YouTube uses a different encoder than you and the encoder will write different information than x264 in ffmpeg. If your file meets the specs of a certain format than its compatible, easy as that.
  If you want to go sure you don't use any fancy format features just use a low profile (e.g. baseline in the case of h264) to ensure compatibility with virtually any device, the lower the profile the less features are allowed.
  
  If you REALLY need to use 3gp you can specify the container with the option `-f 3gp`. Using the BaseLine 1 profile is absolutely suffice.
  Using a ffmpeg commandline like the following will get you what need:
  
  ```
  ffmpeg -i input.mp4 -vf scale=320:240 -vcodec mpeg4 -acodec aac -strict -2 -f
  3gp output.3gp
  
  ```
  
  Note the usage of `mpeg4` instead of libx264. The `mpeg4` encoder is the Mpeg4 Part 2 codec also known as h263. Again, extremely few devices nowadays do not support h264 and I can only advice to support h263 in the 3gp container when you are in dire need to do so or have an extremely large user base that ranks in the tens of millions of users.
  
  Having 3gp6 instead of 3gp4 is irrelevant, you are targeting old devices so using the newest version of the standard doesn't make much sense. FFmpeg will use the 3gp6 container only when using the also newer codec h264 which release 6 is also meant for.
  
  Here and excerpt from the 3gpp v6 standard:
  
  ```
  Specific MBMS Rel-6 application codecs are introduced, like for example audio codecs Extended AMR-WB (AMR-WB+), Enhanced aacPlus and video codec H.264/AVC.
  
  ```
  
  So unless you use h264, there is no need for using Release 6 and you can stick with Release 4 without running into any issues.
  The opposite is actually the case, the older the version the more old devices you will support.
  
  > **Comments:**
  > **username_0**: I'm not sure why YouTube still offers 3GP formats, but since they still do in this late year of 2014, I'm guessing it's for a good reason.  They target not just the US where smarphones are abundant. They also target everywhere else, like 3rd-world countries where supposedly "dumb" phones offer all the Internet people can get. Maybe this is YouTube's purpose in still carrying 3GP.  My site also targets the world audience.  And I'm not just doing 3GP. I'm also doing MP3, WEBM, and FLV like YouTube does. It's just the 3GP part I'm stuck on.  
  > **username_1**: The only reason is for really old phones, they just have to remux their mp4 encodes so its barley any extra work, wouldn't be suprised if they not just change a few bytes in the header. There is a very little percentage of phones that supports 3gp but not mp4. What is your reason for that huge compatability, does you audience mostly consist of legacy device users?  
  > **username_0**: It's in the name of reaching the widest possible audience. But I recognize that the last X percent may take too much effort to reach. Still, if there's an "easy" way to coerce ffmpeg to give me 3gp6 files using MPEG-4 Visual and Simple@L1, I'd like to try it.  
  > **username_1**: I added info on how to encode your videos like that but again, you should definitely see if thats really worth it. It's like doing optimizations for IE6 and 7.  
  > **username_1**: Another edit regarding 3gpp v6 vs v4  
  
  ---
  
  