In this blog we will write smil (Synchronized Multimedia Integration Language) files by nodejs program using fs module. As we know smil files enable us to group the high bitrate stream and the new renditions together in logical groups for live adaptive bitrate delivery.
We have a array with 3 different bitrate and width of video. We have named video as width of video, example 360.mp4, 480.mp4, 640.mp4.
var bitRate = [{ "width": 640, "bit_rate": "600k" }, { "width": 480, "bit_rate": "400k" }, { "width": 360, "bit_rate": "200k" }]; function createSmilFile(){ var smilefile = "} smilefile = smilefile + "</switch > </body > </smil > "; var smil_file_name = test + ".smil"; fs.writeFile( '/opt/smil/' + smil_file_name, smilefile, function(err) { if (err) { console.error("error in create smil file: ", err); } else { console.log("smil file created successfully"); } }); "; for (var i = 0; i < bitRate.length; i++) { var bit = bitRate[i].bit_rate; bit = bit.replace("k", '000'); smilefile = smilefile+"<video src='" + bitRate[i].width + ".mp4" + "' type='video/mp4'> <param name='videoBitrate' value='" + bit + "' valuetype='data'> </param> </video >";
THANKS
More From Oodles
Ready to innovate? Let's get in touch
Cookies are important to the proper functioning of a site. To improve your experience, we use cookies to remember log-in details and provide secure log-in, collect statistics to optimize site functionality, and deliver content tailored to your interests. Click Agree and Proceed to accept cookies and go directly to the site or click on View Cookie Settings to see detailed descriptions of the types of cookies and choose whether to accept certain cookies while on the site.
About Author
Chandan Kumar Singh
Chandan is a bright Web Developer with expertise in Java and Spring framework and ORM tools Hibernate. He loves technologies like Blockchain and IoT.