2

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.

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)

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.

  • 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. – curtisdf Sep 14 '14 at 18:38
  • 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? – PTS Sep 14 '14 at 18:46
  • 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. – curtisdf Sep 14 '14 at 18:54
  • 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. – PTS Sep 14 '14 at 19:16
  • Another edit regarding 3gpp v6 vs v4 – PTS Sep 14 '14 at 20:13
1

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.

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.