7

I'm trying to get lossless conversion of 3gp to mp4 using ffmpeg.

I tried

ffmpeg -i input.3gp -vcodec h264 -c:a aac output.mp4

I tried with "libx264" for the video codec, I tried just a simple

ffmpeg -i input.3gp output.mp4

No matter what I try, for a 10 MB 3gp video I am getting a 5 MB mp4 video that doesn't seem to have the same quality.

Any suggestions are welcome.

Thank you.

EDIT

Here's what I get if I try to copy the Video and Audio codecs:

ffmpeg -i  VIDEO0004.3gp  -c:v copy -c:a copy VIDEO0004.mp4
ffmpeg version 4.4 Copyright (c) 2000-2021 the FFmpeg developers
  built with Apple clang version 12.0.0 (clang-1200.0.32.29)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/4.4 --enable-shared --enable-pthreads --enable-version3 --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gnutls --enable-gpl --enable-libaom --enable-libbluray --enable-libdav1d --enable-libmp3lame --enable-libopus --enable-librav1e --enable-librubberband --enable-libsnappy --enable-libsrt --enable-libtesseract --enable-libtheora --enable-libvidstab --enable-libvorbis --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxml2 --enable-libxvid --enable-lzma --enable-libfontconfig --enable-libfreetype --enable-frei0r --enable-libass --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-libspeex --enable-libsoxr --enable-libzmq --enable-libzimg --disable-libjack --disable-indev=jack --enable-videotoolbox
  libavutil      56. 70.100 / 56. 70.100
  libavcodec     58.134.100 / 58.134.100
  libavformat    58. 76.100 / 58. 76.100
  libavdevice    58. 13.100 / 58. 13.100
  libavfilter     7.110.100 /  7.110.100
  libavresample   4.  0.  0 /  4.  0.  0
  libswscale      5.  9.100 /  5.  9.100
  libswresample   3.  9.100 /  3.  9.100
  libpostproc    55.  9.100 / 55.  9.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'VIDEO0004.3gp':
  Metadata:
    major_brand     : 3gp4
    minor_version   : 768
    compatible_brands: 3gp4mp413gp6
    creation_time   : 2011-02-06T16:39:49.000000Z
    copyright       : 
    copyright-eng   : 
    rating          : 0
    location-eng    : +00.0000+000.0000/??
    location        : +00.0000+000.0000/??
  Duration: 00:01:00.20, start: 0.000000, bitrate: 1369 kb/s
  Stream #0:0(eng): Video: mpeg4 (Simple Profile) (mp4v / 0x7634706D), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 1355 kb/s, 9.90 fps, 9.92 tbr, 1k tbn, 60 tbc (default)
    Metadata:
      creation_time   : 2011-02-06T16:39:49.000000Z
      handler_name    : VideoHandler
      vendor_id       : [0][0][0][0]
  Stream #0:1(eng): Audio: amr_nb (samr / 0x726D6173), 8000 Hz, mono, flt, 12 kb/s (default)
    Metadata:
      creation_time   : 2011-02-06T16:39:49.000000Z
      handler_name    : SoundHandler
      vendor_id       : [0][0][0][0]
[mp4 @ 0x7fbaf5009600] Could not find tag for codec amr_nb in stream #1, codec not currently supported in container
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument
Error initializing output stream 0:1 -- 

1 Answer 1

6

If the codecs of your input file are already h264 and aac for video and audio, respectively, you can just copy without decoding and encoding again.

ffmpeg -i input.3gp -c:v copy -c:a copy output.mp4

The options -c:v copy and -c:a copy indicate video and audio won't be encoded again, respectively. If audio format in the input cannot be embedded to the output, you need to omit -c:a copy from above command.

If you need to encode again, an option -qscale 0 will result similar quality (but not lossless). below is an example. You might combine with -c:v copy or -c:a copy if you don't need to encode video or audio again.

ffmpeg -i input.3gp -qscale 0 output.mp4
2
  • Please check my edited question to see what I get if I try to copy video and audio.
    – D. Joe
    May 9, 2021 at 20:11
  • 2
    According to your error message, the audio need to be encoded again. Fortunately, video does not need to be encoded. This command should work ffmpeg -i input.3gp -c:v copy output.mp4, which will encode audio but won't encode video.
    – kamae
    May 10, 2021 at 14:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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