How to decode and redirect a video to a v4l2sink

Hello,

I’m trying to decode a video and write the output to a v4l2loopback device.

This is what I tried:

gst-launch-1.0 filesrc location=~/silviu/data/tokyo_profile.mp4 ! qtdemux name=demux ! h264parse ! omxh264dec ! nvvidconv ! v4l2sink device=/dev/video1

I also tried without the nvvidconv and I get the same result:

Setting pipeline to PAUSED …
libv4l2: error getting pixformat: Invalid argument
Pipeline is PREROLLING …
NvMMLiteOpen : Block : BlockType = 261
TVMR: NvMMLiteTVMRDecBlockOpen: 7650: NvMMLiteBlockOpen
NvMMLiteBlockCreate : Block : BlockType = 261
TVMR: cbBeginSequence: 1179: BeginSequence 1280x720, bVPR = 0
TVMR: LowCorner Frequency = 100000
TVMR: cbBeginSequence: 1529: DecodeBuffers = 5, pnvsi->eCodec = 4, codec = 0
TVMR: cbBeginSequence: 1600: Display Resolution : (1280x720)
TVMR: cbBeginSequence: 1601: Display Aspect Ratio : (1280x720)
TVMR: cbBeginSequence: 1669: ColorFormat : 5
TVMR: cbBeginSequence:1683 ColorSpace = NvColorSpace_YCbCr601
TVMR: cbBeginSequence: 1809: SurfaceLayout = 3
TVMR: cbBeginSequence: 1902: NumOfSurfaces = 12, InteraceStream = 0, InterlaceEnabled = 0, bSecure = 0, MVC = 0 Semiplanar = 1, bReinit = 1, BitDepthForSurface = 8 LumaBitDepth = 8, ChromaBitDepth = 8, ChromaFormat = 5
TVMR: cbBeginSequence: 1904: BeginSequence ColorPrimaries = 2, TransferCharacteristics = 2, MatrixCoefficients = 2
Allocating new output: 1280x720 (x 12), ThumbnailMode = 0
OPENMAX: HandleNewStreamFormat: 3464: Send OMX_EventPortSettingsChanged : nFrameWidth = 1280, nFrameHeight = 720
ERROR: from element /GstPipeline:pipeline0/Gstnvvconv:nvvconv0: failed to activate bufferpool
Additional debug info:
gstbasetransform.c(1725): default_prepare_output_buffer (): /GstPipeline:pipeline0/Gstnvvconv:nvvconv0:
failed to activate bufferpool
ERROR: pipeline doesn’t want to preroll.
Setting pipeline to NULL …
TVMR: TVMRFrameStatusReporting: 6135: Closing TVMR Frame Status Thread -------------
TVMR: TVMRVPRFloorSizeSettingThread: 5945: Closing TVMRVPRFloorSizeSettingThread -------------
TVMR: TVMRFrameDelivery: 5985: Closing TVMR Frame Delivery Thread -------------
TVMR: NvMMLiteTVMRDecBlockClose: 7818: Done
Freeing pipeline …

Please advise!

Silviu

You may check this topic.

@Honey_Patouceul Thanks for your reply. However, that topic is mostly about installing the v4l2loopback device. I’ve already successfully done that. I can see /dev/video1.
The problem must be somewhere else.

What gives ?

v4l2-ctl -d /dev/video1 --list-formats

Ok, I found a solution. I’m not exactly sure what the problem was but this command seems to work:

gst-launch-1.0 filesrc location=[path_to_video_file] ! qtdemux name=dmux dmux.video_0 ! queue ! h264parse ! omxh264dec ! videoconvert ! video/x-raw, format=I420, height=720, fps=30/1 ! v4l2sink device=/dev/video1

Please refer to https://devtalk.nvidia.com/default/topic/994012/jetson-tx1/passing-gst-launch-from-nvcamerasrc-to-v4l2sink/post/5090232/#5090232