Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Compression Techniques Mux 3gp audio file with jpg image to create video clip

  • Mux 3gp audio file with jpg image to create video clip

    Posted by C david Young on September 24, 2011 at 4:53 pm

    So far I am getting various errors no matter what combination of things I try. Thanks.

    C:Androidimages>C:Androidffmpeg-git-a254452-win32-staticbinffmpeg -y -f image2 -r .2 -i IMAG001.jpg -i “fold doblar.3gp” -acodec copy a.mp4
    ffmpeg version N-32726-ga254452, Copyright (c) 2000-2011 the FFmpeg developers
    built on Sep 19 2011 19:49:13 with gcc 4.6.1
    configuration: –enable-gpl –enable-version3 –enable-runtime-cpudetect –enable-avisynth –enable-bzlib –enable-frei0r –enable-libopencore-amrnb –enable-libopencore-amrwb –enable-libfreetype –enable-libgsm –enable-libmp3lame –enable-libopenjpeg –enable-librtmp –enable-libschroedinger —
    enable-libspeex –enable-libtheora –enable-libvo-aacenc –enable-libvo-amrwbenc –enable-libvorbis –enable-libvpx –enable-libx264 –enable-libxavs –enable-libxvid –enable-zlib
    libavutil 51. 16. 1 / 51. 16. 1
    libavcodec 53. 16. 0 / 53. 16. 0
    libavformat 53. 12. 0 / 53. 12. 0
    libavdevice 53. 4. 0 / 53. 4. 0
    libavfilter 2. 43. 2 / 2. 43. 2
    libswscale 2. 1. 0 / 2. 1. 0
    libpostproc 51. 2. 0 / 51. 2. 0
    Input #0, image2, from ‘IMAG001.jpg’:
    Duration: 00:00:05.00, start: 0.000000, bitrate: N/A
    Stream #0.0: Video: mjpeg, yuvj420p, 3264×1952, 0.20 tbr, 0.20 tbn, 0.20 tbc
    [amr @ 003DF5E0] max_analyze_duration 5000000 reached at 5000000
    [amr @ 003DF5E0] Estimating duration from bitrate, this may be inaccurate
    Input #1, amr, from ‘fold doblar.3gp’:
    Duration: 00:00:14.82, bitrate: 12 kb/s
    Stream #1.0: Audio: amr_nb (samr / 0x726D6173), 8000 Hz, 1 channels, flt, 12 kb/s
    [buffer @ 042720C0] w:3264 h:1952 pixfmt:yuvj420p tb:1/1000000 sar:0/1 sws_param:
    [libx264 @ 04247C20] using cpu capabilities: MMX2 SSE2Fast SSSE3 FastShuffle SSE4.1 Cache64
    [libx264 @ 04247C20] profile High, level 5.1
    [libx264 @ 04247C20] 264 – core 116 r2074 2641b9e – H.264/MPEG-4 AVC codec – Copyleft 2003-2011 – https://www.videolan.org/x264.html – options: cabac=1 ref=3 deblock=1:0:0 analyse=0x3:0x113 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0 deadzone=21,
    11 fast_pskip=1 chroma_qp_offset=-2 threads=3 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=1 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.
    0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
    [mp4 @ 04260820] track 1: could not find tag, codec not currently supported in container
    Output #0, mp4, to ‘a.mp4’:
    Metadata:
    encoder : Lavf53.12.0
    Stream #0.0: Video: h264 (![0][0][0] / 0x0021), yuvj420p, 3264×1952, q=-1–1, 1 tbn, 0.20 tbc
    Stream #0.1: Audio: amr_nb (samr / 0x726D6173), 8000 Hz, 1 channels, 12 kb/s
    Stream mapping:
    Stream #0.0 -> #0.0 (mjpeg -> libx264)
    Stream #1.0 -> #0.1 (copy)
    Could not write header for output file #0 (incorrect codec parameters ?)

    C david Young replied 14 years, 10 months ago 2 Members · 9 Replies
  • 9 Replies
  • Michael Rampe

    September 29, 2011 at 2:02 am

    [C David Young] “Stream #1.0: Audio: amr_nb (samr / 0x726D6173), 8000 Hz, 1 channels, flt, 12 kb/s”

    It looks like the -acodec copy that is giving you grief in the .mp4 container. Try aac (libfaac) or mp3 (libmp3lame) instead.

    Michael

  • C david Young

    September 29, 2011 at 5:11 am

    Thanks for your suggestion, Michael. I am tried aac and got the following error. I also tried just converting the .3gp file to .aac and got the same error. Am I doing anything obviously wrong?

    C:\Android\images>C:/Android/ffmpeg-git-a254452-win32-static/bin/ffmpeg -y -i IMAG001.3gp -acodec aac IMAG001.aac
    ffmpeg version N-32726-ga254452, Copyright (c) 2000-2011 the FFmpeg developers
    built on Sep 19 2011 19:49:13 with gcc 4.6.1
    configuration: –enable-gpl –enable-version3 –enable-runtime-cpudetect –enable-avisynth –enable-bzlib –enable-frei0r –enable-libo
    enable-libspeex –enable-libtheora –enable-libvo-aacenc –enable-libvo-amrwbenc –enable-libvorbis –enable-libvpx –enable-libx264 –en
    libavutil 51. 16. 1 / 51. 16. 1
    libavcodec 53. 16. 0 / 53. 16. 0
    libavformat 53. 12. 0 / 53. 12. 0
    libavdevice 53. 4. 0 / 53. 4. 0
    libavfilter 2. 43. 2 / 2. 43. 2
    libswscale 2. 1. 0 / 2. 1. 0
    libpostproc 51. 2. 0 / 51. 2. 0
    [amr @ 01B785E0] max_analyze_duration 5000000 reached at 5000000
    [amr @ 01B785E0] Estimating duration from bitrate, this may be inaccurate
    Input #0, amr, from ‘IMAG001.3gp’:
    Duration: 00:00:06.74, bitrate: 12 kb/s
    Stream #0.0: Audio: amr_nb (samr / 0x726D6173), 8000 Hz, 1 channels, flt, 12 kb/s
    Incompatible sample format ‘flt’ for codec ‘aac’, auto-selecting format ‘s16’
    [aac @ 01A07BE0] Too many bits per frame requested
    Output #0, adts, to ‘IMAG001.aac’:
    Stream #0.0: Audio: aac, 8000 Hz, 1 channels, s16, 128 kb/s
    Stream mapping:
    Stream #0.0 -> #0.0 (amrnb -> aac)
    Error while opening encoder for output stream #0.0 – maybe incorrect parameters such as bit_rate, rate, width or height

    C:\Android\images>C:/Android/ffmpeg-git-a254452-win32-static/bin/ffmpeg -y -i IMAG001.3gp -acodec aac IMAG001.aac

  • Michael Rampe

    September 29, 2011 at 5:35 am

    Haven’t dealt with your input codec before but:

    [C David Young] “Error while opening encoder for output stream #0.0 – maybe incorrect parameters such as bit_rate, rate, width or height”

    you need to set these parameters…

    here are some examples:
    bitrate: -ab 128k
    rate: -ar 48k
    channels: -ac 2

    Also, by specifying aac as the encoder, you are using the experimental aac encoder. I would recommend installing libfaac and recompiling FFmpeg with –enable-libfaac. The you would specify -acodec libfaac.

    Michael

  • C david Young

    September 29, 2011 at 3:54 pm

    Thanks for the info. I tried

    ffmpeg -y -f image2 -r .2 -i IMAG001.jpg -i IMAG001.3gp -ab 128k -ar 48k -ac 2 -strict experimental -acodec aac IMAG001.mp4

    and it does not give me an error now but, as you said, the results were not good. The audio sounds ok but the image is missing.

    I’ll try recompiling with the –enable-libfaac. It is a good thing that I have spent days trying to get the Win32 cross-compile to work and finally succeeded. I’ll give this a try later today. Thanks!

  • C david Young

    September 29, 2011 at 4:31 pm

    Well, another stumbling block.

    ../ffmpeg/configure –enable-memalign-hack –arch=x86 –target-os=mingw32 –enable-nonfree –enable-libfaac –cross-prefix=i686-w64-mingw32-
    ERROR: libfaac not found

    I have the latest git from ffmpeg…

  • Michael Rampe

    September 30, 2011 at 2:14 am

    [C David Young] “ERROR: libfaac not found”

    You need to install libfaac first:
    https://www.audiocoding.com/faac.html

    And while you are at it, you might as well install x264 and mp3lame as well for flexibility.

    Michael

  • Michael Rampe

    September 30, 2011 at 2:16 am

    [C David Young] “The audio sounds ok but the image is missing.”

    You need the -map command for two inputs.

    Michael

  • C david Young

    September 30, 2011 at 5:46 pm

    Michael,

    Thanks for your patience.

    I am trying to follow the instructions in the INSTALL file that follow. Is this the correct way to install libfaac? In particular, the part about libmp4v2 is confusing.

    General FAAC compiling instructions

    1. Make sure you have recent versions of autoconf, automake and libtool installed.
    For MP4 writing and tagging support, you must enable compiling with internal libmp4v2 (included in /common/mp4v2/).
    2. cd to FAAC source dir
    3. Run:
    ./configure
    make
    make install

  • C david Young

    September 30, 2011 at 6:34 pm

    I tried putting “-map 0:v” after the video input and it made no difference. I also put “-map 0:a” after the audio input and it said there was no such stream. However, I am having some success as follows. Now to see if I can append the individual slides, each of which will be an mp4 file.

    I can convert the 3gp audio to aac with the following:

    ffmpeg -y -i IMAG001.3gp -ab 128k -ar 48k -ac 2 -strict experimental -acodec aac IMAG001.aac

    When I add the video the resulting mp4 plays the audio with the image.

    ffmpeg -y -f image2 -r .2 -i IMAG001.jpg -i IMAG001.aac -s 720×480 IMAG001.mp4

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy