-1

I'm trying to create a m4v video with the following command using ffmpeg:

ffmpeg -loop 1 -i orange640x360.png -i Be+Present.mp3 -tune stillimage -shortest -c:v libx264 -c:a copy ./Be+Presentorange640x360.m4v

This is the error that I'm getting:

[ipod @ 0x7fbbc9801600] Could not find tag for codec mp3 in stream #1, codec not currently supported in container


Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument

If I do the same command to create a mp4 video, it works correctly, as such:

ffmpeg -loop 1 -i orange640x360.png -i Be+Present.mp3 -tune stillimage -shortest -c:v libx264 -c:a copy ./Be+Presentorange640x360.mp4

.m4v is the required format for jPlayer which I'm currently using.

  • Not sure why I was down voted. Can someone please tell me what is wrong with my question instead of just down voting? – HelpMeStackOverflowMyOnlyHope Sep 12 '16 at 20:43
  • I think that the error message says it all - you are trying to put mp3 in an m4v container and IMHO it only takes AAC. So either use an AAC audio source or try switching to mp4. – Rudolfs Bundulis Sep 12 '16 at 21:36
  • It was probably downvoted because it is off-topic: Stack Overflow is specifically only for programming questions. General `ffmpeg` cli usage questions are on-topic at [su] – llogan Sep 12 '16 at 23:03

1 Answers1

1

Since I was not sure I looked it up and yeah - FFmpeg considers m4v files to be a raw video stream container without any audio. From rawenc.c on github:

#if CONFIG_M4V_MUXER
AVOutputFormat ff_m4v_muxer = {
    .name              = "m4v",
    .long_name         = NULL_IF_CONFIG_SMALL("raw MPEG-4 video"),
    .extensions        = "m4v",
    .audio_codec       = AV_CODEC_ID_NONE,
    .video_codec       = AV_CODEC_ID_MPEG4,
    .write_header      = force_one_stream,
    .write_packet      = ff_raw_write_packet,
    .flags             = AVFMT_NOTIMESTAMPS,
};
#endif

So the error is appropriate, since you are trying to put an MP3 audio stream inside m4v. I'd suggest trying the mp4 version - docs and examples of jPlayer indicate that it should handle it.

Rudolfs Bundulis
  • 11,636
  • 6
  • 33
  • 71
  • Within the jPlayer docs I see this requirement: "Essential video format: m4v". I tried doing .jPlayer("setMedia", {m4v: "https://xyz.cloudfront.net/video/Be%2BPresentorange640x360.mp4"}) and that works in the Chrome browser, but in the Safari browser I get an Error with the message: "Media URL could not be loaded." If I supply a .m4v encoded video Safari works. Not sure why its not working with Safari. If you need the real urls to test yourself please let me know. – HelpMeStackOverflowMyOnlyHope Sep 12 '16 at 23:08
  • Well their docs state that the `m4v` key is a 1String : Defines the URL of the mp4 video format (MP4: H.264/AAC)`. That being said, since you've tried it out and found that it fails - maybe Apple does require some DRM stuff or something. As far as I know since Safari tries to force everyone to use HLS there could be multiple restrictions on the mp4 file. One of which I am aware is that Safari does not handle fragmented mp4 but I don't think this one is since you have to pass explicit flags to indicate generation of a fragmented mp4. – Rudolfs Bundulis Sep 12 '16 at 23:13
  • @HelpMeStackOverflowMyOnlyHope you could actually make a m3u playlist with a single segment which is the same file encoded in a mpeg2 container and set that as a m3u8v playlist on Safari (switching on the user agent). – Rudolfs Bundulis Sep 12 '16 at 23:16