DASH video frame capture

112 views
Skip to first unread message

František Kadúch

unread,
Nov 30, 2020, 8:48:08 AM11/30/20
to javacv
Hi all,

I am trying to grab the video frames from a DASH manifest video stream.Here is my code for an Android app
String asset_url = "https://.../manifest.mpd";
FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(asset_url);
AndroidFrameConverter converterToBitmap = new AndroidFrameConverter();

try
{
grabber.setFormat("mp4");
grabber.start();

for ( int frameCount = 0; frameCount < grabber.getLengthInVideoFrames();       frameCount++ )
 { 
     Frame nthFrame = grabber.grabImage(); 
     Bitmap bitmap = converterToBitmap.convert(nthFrame); 
     saveImageToInternalStorage(bitmap, "test" + nthFrame);
 }
}
catch ( FrameGrabber.Exception e )
{
e.printStackTrace();
}

But I am getting this error:
2020-11-30 14:42:03.065 31125-31125/sk.satro.javacvtest W/System.err: org.bytedeco.javacv.FrameGrabber$Exception: avformat_open_input() error -5: Could not open input "https://sec-stream1.stream.satro.sk/vod2/_definst_/amlst:markiza/56827144_20201130094402/manifest.mpd". (Has setFormat() been called?)
2020-11-30 14:42:03.068 31125-31125/sk.satro.javacvtest W/System.err:     at org.bytedeco.javacv.FFmpegFrameGrabber.startUnsafe(FFmpegFrameGrabber.java:876)
2020-11-30 14:42:03.070 31125-31125/sk.satro.javacvtest W/System.err:     
...

So the question is how to initialize FFmpegFrameGrabber and what format string to pass to the setFormat() call?

thanks

Frantisek

Samuel Audet

unread,
Nov 30, 2020, 10:43:41 PM11/30/20
to jav...@googlegroups.com, František Kadúch
Please make sure FFmpegLogCallback.set() has been called. You'll
probably get more information about the error in the log that way.

Samuel Audet

unread,
Dec 3, 2020, 7:28:53 AM12/3/20
to František Kadúch, javacv
This is a network problem. Fix your network and it should work.

On 12/3/20 9:22 PM, František Kadúch wrote:
> 2020-12-03 13:14:55.646 8632-8632/sk.satro.javacvtest W/System.err: Error: [tcp @ 0x7985c11100] Failed to resolve hostname sec-stream1.stream.satro.sk <http://sec-stream1.stream.satro.sk>: No address associated with hostname
> 2020-12-03 13:14:55.647 8632-8632/sk.satro.javacvtest W/System.err: Error: [tcp @ 0x7985c11100] Failed to resolve hostname sec-stream1.stream.satro.sk <http://sec-stream1.stream.satro.sk>: No address associated with hostname

František Kadúch

unread,
Dec 3, 2020, 7:40:58 AM12/3/20
to Samuel Audet, javacv
Ok, thanks. But does the library work with https, I mean does it have support for SSL?

št 3. 12. 2020 o 13:28 Samuel Audet <samuel...@gmail.com> napísal(a):

Samuel Audet

unread,
Dec 3, 2020, 7:55:01 AM12/3/20
to František Kadúch, javacv
That class isn't available on Android. Do not set the
"org.bytedeco.javacpp.mxbean" system property and it will work fine.

On 12/3/20 9:49 PM, František Kadúch wrote:
> I appreciate your help, fixed network access, but now I am getting
> different error. Could you please kindly take a look at it ?
>
> 2020-12-03 13:45:02.198 9155-9155/sk.satro.javacvtest I/atro.javacvtes: Rejecting re-init on previously-failed class
> java.lang.Class<org.bytedeco.javacpp.tools.PointerBufferPoolMXBean>: java.lang.NoClassDefFoundError: Failed resolution of: Ljava/lang/management/BufferPoolMXBean;

Samuel Audet

unread,
Dec 3, 2020, 9:14:55 AM12/3/20
to František Kadúch, javacv
Well, I can't reproduce that error here, so it's going to be hard for me to debug this.
You're also the only person I ever heard that is having a problem like that...
In any case, please post an issue about it on GitHub for tracking purposes:

One way for sure to fix this would be to recompile your own version of JavaCPP without that class.

On 12/3/20 10:19 PM, František Kadúch wrote:
I added this code m but the same error still persists:

 Caused by: java.lang.ClassNotFoundException: Didn't find class "java.lang.management.BufferPoolMXBean" on path: DexPathList[[zip file "/data/app/sk.satro.javacvtest-BiGXp6EGnKmfOskri925_g==/base.apk"],nativeLibraryDirectories=[/data/app/sk.satro.javacvtest-BiGXp6EGnKmfOskri925_g==/lib/arm64, /data/app/sk.satro.javacvtest-BiGXp6EGnKmfOskri925_g==/base.apk!/lib/arm64-v8a, /system/lib64]]
System.clearProperty("org.bytedeco.javacpp.mxbean");
System.out.println("org.bytedeco.javacpp.mxbean" + " = " + System.getProperty("org.bytedeco.javacpp.mxbean"));

String asset_url = "https://sec-stream1.stream.satro.sk/vod2/_definst_/amlst:markiza/56827144_20201130094402/manifest.mpd";
FFmpegFrameGrabber grabber = new FFmpegFrameGrabber(asset_url);
grabber.setFormat("mp4");
FFmpegLogCallback.set();
AndroidFrameConverter converterToBitmap = new AndroidFrameConverter();

thanks

Frantisek

št 3. 12. 2020 o 13:54 Samuel Audet <samuel...@gmail.com> napísal(a):

František Kadúch

unread,
Dec 3, 2020, 10:14:23 AM12/3/20
to Samuel Audet, javacv
Ok, I'll do that. But still would like to know, if the javacpp,jar is needed for the sake of just grabbing the frames.

thanks

št 3. 12. 2020 o 15:14 Samuel Audet <samuel...@gmail.com> napísal(a):
Reply all
Reply to author
Forward
0 new messages