31112

Verify video encoding is H.264

Question:

I need to verify that a video file is (in Java):

<ul><li>Video is H.264 Encoded</li> <li>Audio is AAC Encoded</li> </ul>

I've looked into JMF and Xuggle.

Xuggle makes it easier to load and decode the file and turn it into another format, but I've not been able to figure out how to determine the encoding of the file that I've loaded as of yet.

So Im wondering if Xuggle has the capability to simply return the type of Video & Audio encoding a file has or do I need to read the bits of the file to determine this myself?

If I need to determine this myself, can someone point me to some documention on the format of H.264

Answer1:

So I looked at Xuggler's Decoding Demo and found my answer, so for anyone in the future looking for a similar solution here is the code I wrote:

<hr /> // create a Xuggler container object IContainer container = IContainer.make(); if(container.open(file.getPath(),IContainer.Type.READ,null) < 0) { return false; } // query how many streams the call to open found boolean isH264 = false; boolean isAAC = false; int numStreams = container.getNumStreams(); for(int i = 0; i < numStreams; i++) { // find the stream object IStream stream = container.getStream(i); // get the pre-configured decoder that can decode this stream; IStreamCoder coder = stream.getStreamCoder(); if (coder.getCodecID() == ID.CODEC_ID_H264) { isH264 = true; } if (coder.getCodecID() == ID.CODEC_ID_AAC) { isAAC = true; } } if (container !=null) { container.close(); container = null; } return isH264 && isAAC;

Answer2:

This is couple of lines with JCodec ( <a href="http://jcodec.org" rel="nofollow">http://jcodec.org</a> ):

MovieBox movie = MP4Util.parseMovie(new File("path to file")); Assert.assertEquals(movie.getVideoTrack().getSampleEntries()[0].getFourcc(), "avc1"); for (TrakBox trakBox : movie.getAudioTracks()) { Assert.assertEquals(trakBox.getSampleEntries()[0].getFourcc(), "mp4a"); }

Recommend

  • Xuggler Repository Link Broken
  • When is garbage collector used in java?
  • Set of questions related to playing sound / video in java
  • How to display function arguments in Spyder?
  • how to include a template with parameters in EJS?
  • Given the user's identity id, how to get the user's details from cognito user pool?
  • noob queries on unicode and str methods in Python
  • How do I keep Google Analytics from corrupting query strings that contain %26?
  • Where can I find a sample for Pcap for Diameter protocol (WireShark)? [closed]
  • How can I decode an encoded-word String?
  • How to build xuggler for Android?
  • getUserMedia results in TrackStartError in Chrome
  • Add Jpanel to Jframe NetBeans
  • 302 Redirect from http to https in Android using Dropbox short Hyperlinks
  • How to convert Neo4j Result to GraphJSON
  • Finding number of samples in a .wav header
  • How to crop a mp3 in ASP.NET + C#?
  • Recursion in ASP.NET Core Razor views
  • help('modules') crashing? Not sure how to fix
  • Angular Bootstrap Carousel Slide Transition not working correctly
  • Can I use AllJoyn Framework for Wifi Direct in iOS?
  • How can I sort a a table with VBA with given text condition?
  • Highlight one bar in a series in highcharts?
  • Android screen density dpi vs ppi
  • How would I use PHP exceptions to define a redirect?
  • How to extract text from Word files using C#?
  • Jquery - Jquery Wysiwyg return html as a string
  • Rearranging Cells in UITableView Bug & Saving Changes
  • Hibernate gives error error as “Access to DialectResolutionInfo cannot be null when 'hibernate.
  • Circular dependency while pushing http interceptor
  • Arrays break string types in Julia
  • Linker errors when using intrinsic function via function pointer
  • WPF Applying a trigger on binding failure
  • How can I get HTML syntax highlighting in my editor for CakePHP?
  • FormattedException instead of throw new Exception(string.Format(…)) in .NET
  • How do I configure my settings file to work with unit tests?
  • Java static initializers and reflection
  • need help with bizarre java.net.HttpURLConnection behavior
  • IndexOutOfRangeException on multidimensional array despite using GetLength check
  • Binding checkboxes to object values in AngularJs