1

I'm rying to create .m4s files and I'm using this command with ffmpeg: ffmpeg -i input.mov -c:v copy output.m4s

The file can't be created.

Output: Unable to find a suitable output format for tempM4S.m4s tempM4S.m4s: Invalid argument

I'm guessing the file format .m4s is not supported by ffmpeg which is strange because ffmpeg can create .m4s files when trying to create segments for MPEG-DASH. Is there a workaround this problem? WIll I have to use other tools or check ffmpeg's source code for hints?

Pedro Romano Barbosa
  • 587
  • 3
  • 11
  • 29

3 Answers3

0

m4s files do not work by themselves as they do not contain a moov box required for playback. They require an initialization fragment as well.

szatmary
  • 29,969
  • 8
  • 44
  • 57
0

I am guessing you want to create m4s to include it as part of m4s series. As @szatmary mentioned, these files are not independent. So you can try this:

  1. Merge the m4s files to one mov file.
  2. Merge your mov file with the step 1 output file.
  3. Split again the output file of step 2 to m4s files.
elirandav
  • 1,913
  • 19
  • 27
0

Here's how I achieved this. My use case is an audio-only stream. The backend service ships MPEG-DASH files to static hosting. I upload the initializing .mp4 segment once, subsequently only uploading each new .m4s segment.

Also, the playlist .mpd is updated every segment, in order to tell a newly arriving listener where to begin playback. The listener will pick up an initializing .mp4 file for the desired bitrate, followed by the current and following .m4s segments.

  • My source material is a series of 10-second media segments in uncompressed .wav format.
  • I'll run ffmpeg once per each new media segment
  • I've specified a segment size of 11 seconds, to ensure that ffmpeg generates exactly 1 output .m4s segment for each source media segment.
ffmpeg \
  -i pelicans-1234.wav \
  -f hls \
  -ac 2 \
  -c:a aac \
  -b:a 128k \
  -minrate 128k \
  -maxrate 128k \
  -start_number 1234 \
  -hls_fmp4_init_filename pelicans-128k-IS.mp4 \
  -hls_segment_filename pelicans-128k-%d.m4s \
  -hls_segment_type fmp4 \
  -hls_time 11 \
  temp.m3u8
Charney Kaye
  • 3,667
  • 6
  • 41
  • 54
  • Update: So far, attempts to ship an MPEG-DASH stream using this method have failed with errors (in VLC) like `mp4: Fragment sequence discontinuity detected 1 != 2` which makes me think that I need to tell ffmpeg what the starting segment number is – Charney Kaye Oct 15 '21 at 07:47
  • My quest continues in https://stackoverflow.com/questions/69625970/java-mp4parser-to-create-a-single-m4s-fragment – Charney Kaye Oct 21 '21 at 19:42