Reputation: 642
I muxed the video and audio and then converted it to avi. The converted file has a size of 20mb but when i open it says cannot play the video. I tried playing it on a mobile also. Initially i tried converting it to mp4 but i was getting error like muxer does not support non seekable output Could not write header for output file
Below is the code what i used. Can someone please tell me the mistake i'm doing.
$video = "C:\Users\user.folder\Downloads\video_with_no_audio.mp4";
$audio = "C:\Users\user.folder\Downloads\just_audio.mp3";
$cmd = FCPATH.'ffmpeg/bin';
$cmd1 = $cmd.'\ffmpeg -i '.$video.' -i '.$audio.' -y 2>&1 -f avi-';
header('Content-type: video/avi');
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=file.avi");
echo passthru($cmd1);exit;
I Even tried with the following code
$cmd1 = $cmd.'\ffmpeg -i '.$video.' -i '.$audio.' -c:v copy -c:a copy -y 2>&1 -f avi -';
Upvotes: 1
Views: 212
Reputation: 1609
and at last define output file path.
$ffmpegpath = "ffmpeg.exe";
$video_file = "C:\Users\user.folder\Downloads\video_with_no_audio.mp4";
$audio_file = "C:\Users\user.folder\Downloads\just_audio.mp3";
$target_video = "file.avi";
system("$ffmpegpath -i $audio_file -i $video_file -y $target_video");
Upvotes: 1