iTunes can play such M4A only after downloading. I found another podcast with M4A and iTunes stream those episodes correctly.

My command is

ffmpeg -i input.ogg output.m4a


ffmpeg version 3.3.4-static http://johnvansickle.com/ffmpeg/  Copyright (c) 2000-2017 the FFmpeg developers
  built with gcc 6.4.0 (Debian 6.4.0-4) 20170820
  configuration: --enable-gpl --enable-version3 --enable-static --disable-debug --disable-ffplay --disable-indev=sndio --disable-outdev=sndio --cc=gcc-6 --enable-fontconfig --enable-frei0r --enable-gnutls --enable-gray --enable-libfribidi --enable-libass --enable-libfreetype --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopenjpeg --enable-librubberband --enable-librtmp --enable-libsoxr --enable-libspeex --enable-libvorbis --enable-libopus --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvpx --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxvid --enable-libzimg
  libavutil      55. 58.100 / 55. 58.100
  libavcodec     57. 89.100 / 57. 89.100
  libavformat    57. 71.100 / 57. 71.100
  libavdevice    57.  6.100 / 57.  6.100
  libavfilter     6. 82.100 /  6. 82.100
  libswscale      4.  6.100 /  4.  6.100
  libswresample   2.  7.100 /  2.  7.100
  libpostproc    54.  5.100 / 54.  5.100
Input #0, ogg, from 'input.ogg':
  Duration: 00:00:04.12, start: 0.000000, bitrate: 40 kb/s
    Stream #0:0: Audio: vorbis, 22050 Hz, mono, fltp, 35 kb/s
Stream mapping:
  Stream #0:0 -> #0:0 (vorbis (native) -> aac (native))
Press [q] to stop, [?] for help
Output #0, ipod, to 'output.m4a':
    encoder         : Lavf57.71.100
    Stream #0:0: Audio: aac (LC) (mp4a / 0x6134706D), 22050 Hz, mono, fltp, 69 kb/s
      encoder         : Lavc57.89.100 aac
size=      35kB time=00:00:04.13 bitrate=  69.5kbits/s speed=36.4x
video:0kB audio:34kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 3.260525%
[aac @ 0x56fc940] Qavg: 11478.364

I need more carefully read documentation...

Quote from https://trac.ffmpeg.org/wiki/Encode/AAC#Progressivedownload:

By default the MP4 muxer writes the 'moov' atom after the audio stream ('mdat' atom) at the end of the file. This results in the user requiring to download the file completely before playback can occur. Relocating this moov atom to the beginning of the file can facilitate playback before the file is completely downloaded by the client.

You can do this with the -movflags +faststart option:

ffmpeg -i input.wav -c:a libfdk_aac -movflags +faststart output.m4a You can also use this option on existing MP4/M4A files. Since the audio is simply being stream copied there is no re-encoding occurring, just re-muxing, so therefore there is no quality loss:

ffmpeg -i input.m4a -c:a copy -movflags +faststart output.m4a

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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