FFMPEG MOV to MP4 error {Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument}

45,090

FFmpeg does not mux PCM audio in MP4 files, so you'll have to convert using a supported codec like AAC, MP3, AC3..etc.

For AAC encoding, use -c:a aac

e.g.

ffmpeg -i "MVI_9692.MOV" -i 360.png -threads 12 -c:a aac 
       -filter_complex "scale=-2:360,overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2"
       "MVI_9692.MOV_360.mp4"
Share:
45,090
Diaa Saada
Author by

Diaa Saada

I'm a tech and programming enthusiast with 7+ years of hard-core experience in web and mobile development. currently started team lead position which gave me more encouragement to push myself and my team to excel and build smart cool apps each day. I'm always learning and improving to boost my work and to help people around me. I love teamwork, agile and coffee. Feel free to contact me for a question,consultation or a job offer Email: [email protected] Linkedin: https://www.linkedin.com/in/diaa88/

Updated on July 23, 2020

Comments

  • Diaa Saada
    Diaa Saada almost 4 years

    I'm using FFMPEG to convert and watermar videos

    ffmpeg -i "MVI_9692.MOV"   -i 360.png  -acodec copy -threads 12  -filter_complex "scale=-2:360,overlay=(main_w-overlay_w)/2:(main_h-overlay_h)/2"  "MVI_9692.MOV_360.mp4"
    

    this command isworking OK with with diffrent format videos but I got this error message for one of the MOV videos

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

    and these are the warnings I got before the error message

    [swscaler @ 0x47adf20] deprecated pixel format used, make sure you did set range correctly
    
    [mp4 @ 0x4729540] Codec for stream 1 does not use global headers but container format requires global headers
    [mp4 @ 0x4729540] Could not find tag for codec pcm_s16le in stream #1, codec not currently supported in container
    
  • Diaa Saada
    Diaa Saada almost 8 years
    thanks it works with little change ffmpeg -i "MVI_9692.MOV" -i 360.png -threads 12 -c:a libvo_aacenc -filter_complex "scale=-2:360,overlay=(main_w-overlay_w)/2:(main_h-overlay_h‌​)/2" "MVI_9692.MOV_360.mp4"
  • Gyan
    Gyan almost 8 years
    You've an old version of FFmpeg. The libvo encoder has been removed, since the native one is now better. Upgrade, and you can use my original command.
  • Lebnik
    Lebnik about 4 years
    [aac @ 0x1ec04c0] Estimating duration from bitrate, this may be inaccurate [aac @ 0x1ec04c0] Could not find codec parameters for stream 0 (Audio: aac (LC), 7.1, fltp, 323 kb/s): unspecified sample rate Consider increasing the value for the 'analyzeduration' and 'probesize' options video.ts: could not find codec parameters Input #0, aac, from 'video.ts': Duration: 02:11:07.36, bitrate: 323 kb/s Stream #0:0: Audio: aac (LC), 7.1, fltp, 323 kb/s Cannot find a matching stream for unlabeled input pad 0 on filter Parsed_scale_0
  • Gyan
    Gyan about 4 years
    @Lebnik seems unrelated to this Q and A. Open a new Q with full command and log.