Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

ffmpeg

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
like image 493
Diaa Saada Avatar asked Jul 11 '16 14:07

Diaa Saada


1 Answers

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"
like image 91
Gyan Avatar answered Oct 21 '22 00:10

Gyan