Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ffmpeg converted .mp4 videos are not playing on windows

Tags:

ffmpeg

I am converting videos with extension "flv","avi","mp4","mkv", "mpg", "wmv", "asf", "webm","mov","3gp","3gpp" into "mp4" for a better quality.

Command I am using:

ffmpeg -i <server_path>/g9zyy2qg54qp1l5spo2-mergedFile.webm -strict -2 -vcodec libx264 -preset slow -vb 500k -maxrate 500k -bufsize 1000k -vf 'scale=-1:480 ' -threads 0 -ab 64k -s 640x480 -movflags faststart -metadata:s:v:0 rotate=0 <server_path>/g9zyy2qg54qp1l5spo2-mergedFile7.mp4

Videos are working fine everywhere except on Windows. No Video is working on window platform. I tried playing them on firefox, opera, even downloaded them and played on media player software but didn't work at all.

Can you please tell me codecs I should use that make the videos play on windows as well?

like image 681
Curious Developer Avatar asked Jan 22 '16 09:01

Curious Developer


People also ask

Does FFmpeg work with mp4?

FFmpeg can input most container formats natively, including MP4, . ts, MOV, AVI, Y4M, MKV, and many others. This is the output file. No switch necessary; just the file name.

Can FFmpeg play videos?

Ffmpeg stands for Fast Forward MPEG. It's an opensource software project for working with audio and video. It is command-line based and lets you handle video, audio, multimedia files, and streams.


2 Answers

My video gets played in Windows 10 after adding parameters about pix_fmt and resolution (width and height should be even number):

ffmpeg -i temp-%d.png -c:v libx264 -strict -2 -preset slow -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" -f mp4 output.mp4

like image 88
ppppplv Avatar answered Oct 24 '22 06:10

ppppplv


Use

"ffmpeg -i {$audioFile} -i {$videoFile} -map 1:0 -map 0:0 -strict -2 -vcodec libx264 -preset slow -vb 500k -maxrate 500k -bufsize 1000k -vf 'scale=-1:480 ' -threads 0 -ab 64k -s 640x480 -movflags +faststart -metadata:s:v:0 rotate=0 -fflags +genpts <server_path>/g9zyy2qg54qp1l5spo2-mergedFile7.mp4

(this uses the original command in your question)

like image 34
Gyan Avatar answered Oct 24 '22 08:10

Gyan