{"id":5399,"date":"2014-03-30T21:27:38","date_gmt":"2014-03-30T21:27:38","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/converting-into-flv-using-java-collection-of-common-programming-errors\/"},"modified":"2014-03-30T21:27:38","modified_gmt":"2014-03-30T21:27:38","slug":"converting-into-flv-using-java-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/30\/converting-into-flv-using-java-collection-of-common-programming-errors\/","title":{"rendered":"Converting into FLV using Java-Collection of common programming errors"},"content":{"rendered":"<ul>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/ffbf4e85b8ffbae4e9039b9c0cf07bc8?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nerickson<\/p>\n<p>does anybody know how to convert any kind of video format into flv using java, i have been searching for a java api for converting video but it seems that there is no such thing but there might be a way to do it, i mean to make something like youtube service does converting the videos, but using java, i need a web application that can show videos into FLv Format but to be uploaded in any format, if somebody has made something like this please let me know how or any idea,<\/p>\n<p>thanks.<\/p>\n<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/89927e2f4bde24991649b353a37678b9?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nBalusC<\/li>\n<li><img decoding=\"async\" src=\"http:\/\/www.gravatar.com\/avatar\/50c292ce2cfb503644c011e057e7c0cd?s=32&amp;d=identicon&amp;r=PG\" \/><br \/>\nMondain<\/p>\n<p>Using xuggler, here is a simple piece of code to do exactly what you asked for:<\/p>\n<pre><code>\npublic class AnyMediaConverter {\n    public void main(String[] args) {\n        \/\/assumes the following: arg0 is input file and arg1 is output file\n        IMediaReader reader = ToolFactory.makeReader(args[0]);\n        IMediaWriter writer = ToolFactory.makeWriter(args[1], reader);\n        writer.open();\n        writer.setForceInterleave(true);\n        IContainerFormat outFormat = IContainerFormat.make();\n        outFormat.setOutputFormat(\"flv\", args[1], null);\n        IContainer container = writer.getContainer();\n        container.open(args[1], IContainer.Type.WRITE, outFormat);\n        writer.addVideoStream(0, 0, ICodec.findEncodingCodecByName(\"flv\"), 320, 240);\n        writer.addAudioStream(1, 0, ICodec.findEncodingCodecByName(\"libmp3lame\"), 2, 44100);\n        reader.addListener(writer);\n        while (reader.readPacket() == null);\n    }\n}\n<\/code><\/pre>\n<p>now try doing that in JMF or FMJ or whatever (if you want a headache)<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>erickson does anybody know how to convert any kind of video format into flv using java, i have been searching for a java api for converting video but it seems that there is no such thing but there might be a way to do it, i mean to make something like youtube service does converting [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-5399","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5399","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=5399"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/5399\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=5399"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=5399"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=5399"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}