I'm trying to play multiple video files in one html player as if it's a single file. For now, I found a script to play videos one after the other in the same player :
Solution 1:
Solution 2:
Try This :`
This is an HTML code in which you can add more than one video at a time on your page.
<video width="400" controls autoplay>
<source src="my-third-video.mp4" type ="video/mp4" >
</video>
<video width="400" controls autoplay>
<source src="my-second-video.mp4" type ="video/mp4" >
</video>
<video width="400" controls>
<source src="my-third-video.mp4" type ="video/mp4" >
</video>
Copy Solution 3:
You can join the files as a temporary or permanent output.mp4 file and then run that video on your script. If the files are small, it takes a few seconds. I have join huge files, and did not take too long.
For ffmpeg you can create a list from your array and issue the command
ffmpeg -f concat -safe 0 -i mylist.txt -c copy output .mp4
Copy List must be with this format on plain txt (you can create the file in your server using your array):
file my-first-video .mp4
file my-second-video .mp4
file my-thrid-video .mp4
Copy if you don not want to create a list, you can create directly from files on a folder, it goes from first mp4 listed with "ls" and ends with the last mp4 found.
ffmpeg $( for f in *.mp4 ; do echo -n "-i $f " ; done) -filter_complex "$(i=0 ; for f in *.mp4 ; do echo -n " [$i :v ] [$i :a ] " ; i=$((i+1)) ; done && echo " concat=n=$i :v= 1 :a= 1 [v] [a]")" -map "[v]" -map "[a]" output.mp4
Copy Then you can use that output.mp4 simulate one only file without users figure it out. Hope it works for you Regards.
Post a Comment for "Play Multiple Files As One In Video Html Tag"