I have a wireshark capture in pcapng format containing an RTSP H.264 stream that I would like to convert to a playable video file.
Important: the platform is Windows
What I've tried without success:
- Wireshark h264 extractor: https://github.com/volvet/h264extractor
I can configure wireshark to recognize the packets as H.264 with the correct RTP payload number, then run the extractor. The resulting file has a non-zero size but it is not playable. VLC console, configured explicitly with the H264 demuxer reports the following:
[0000026233e408f0] hevc demux packetizer error: Failed decoding VPS id 0
If configured automatically, VLC fails silently without any prints
- Gstreamer 1.x (command line)
First convert the pcapng file to pcap so that we can use pcapparser
- If not specifying any decoder
gst-launch-1.0 filesrc location="recording1.pcap" ! pcapparse ! filesink location="outputfile.ts"
An unplayable file will be created
- Using rtph264depay
gst-launch-1.0 -m -v filesrc location=recording1.pcap ! pcapparse !"application/x-rtp, payload=96" ! rtph264depay ! "video/x-h264" ! filesink location=myfile.ts
Will create a 0 KB file and output the following on console:
Use Windows high-resolution clock, precision: 1 ms
Setting pipeline to PAUSED ...
Pipeline is PREROLLING ...
Got message #18 from element "filesink0" (state-changed): GstMessageStateChanged, old-state=(GstState)null, new-state=(GstState)ready, pending-state=(GstState)void-pending;
Got message #19 from element "capsfilter1" (state-changed): GstMessageStateChanged, old-state=(GstState)null, new-state=(GstState)ready, pending-state=(GstState)void-pending;
Got message #20 from element "rtph264depay0" (state-changed): GstMessageStateChanged, old-state=(GstState)null, new-state=(GstState)ready, pending-state=(GstState)void-pending;
Got message #21 from element "capsfilter0" (state-changed): GstMessageStateChanged, old-state=(GstState)null, new-state=(GstState)ready, pending-state=(GstState)void-pending;
Got message #22 from element "pcapparse0" (state-changed): GstMessageStateChanged, old-state=(GstState)null, new-state=(GstState)ready, pending-state=(GstState)void-pending;
Got message #23 from element "filesrc0" (state-changed): GstMessageStateChanged, old-state=(GstState)null, new-state=(GstState)ready, pending-state=(GstState)void-pending;
Got message #24 from element "pipeline0" (state-changed): GstMessageStateChanged, old-state=(GstState)null, new-state=(GstState)ready, pending-state=(GstState)paused;
Got message #26 from element "capsfilter1" (state-changed): GstMessageStateChanged, old-state=(GstState)ready, new-state=(GstState)paused, pending-state=(GstState)void-pending;
Got message #27 from element "rtph264depay0" (state-changed): GstMessageStateChanged, old-state=(GstState)ready, new-state=(GstState)paused, pending-state=(GstState)void-pending;
Got message #28 from element "capsfilter0" (state-changed): GstMessageStateChanged, old-state=(GstState)ready, new-state=(GstState)paused, pending-state=(GstState)void-pending;
Got message #29 from element "pcapparse0" (state-changed): GstMessageStateChanged, old-state=(GstState)ready, new-state=(GstState)paused, pending-state=(GstState)void-pending;
Got message #32 from pad "filesrc0:src" (stream-status): GstMessageStreamStatus, type=(GstStreamStatusType)create, owner=(GstElement)"\(GstFileSrc\)\ filesrc0", object=(GstTask)"\(GstTask\)\ filesrc0:src";
Got message #33 from element "filesrc0" (state-changed): GstMessageStateChanged, old-state=(GstState)ready, new-state=(GstState)paused, pending-state=(GstState)void-pending;
Got message #34 from pad "filesrc0:src" (stream-status): GstMessageStreamStatus, type=(GstStreamStatusType)enter, owner=(GstElement)"\(GstFileSrc\)\ filesrc0", object=(GstTask)"\(GstTask\)\ filesrc0:src";
Got message #35 from element "pipeline0" (stream-start): GstMessageStreamStart, group-id=(uint)1;
Got message #42 from pad "capsfilter0:src" (property-notify): GstMessagePropertyNotify, property-name=(string)caps, property-value=(GstCaps)"application/x-rtp\,\ payload\=\(int\)96\,\ media\=\(string\)video\,\ clock-rate\=\(int\)90000\,\ encoding-name\=\(string\)H264";
/GstPipeline:pipeline0/GstCapsFilter:capsfilter0.GstPad:src: caps = application/x-rtp, payload=(int)96, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
Got message #43 from pad "rtph264depay0:sink" (property-notify): GstMessagePropertyNotify, property-name=(string)caps, property-value=(GstCaps)"application/x-rtp\,\ payload\=\(int\)96\,\ media\=\(string\)video\,\ clock-rate\=\(int\)90000\,\ encoding-name\=\(string\)H264";
/GstPipeline:pipeline0/GstRtpH264Depay:rtph264depay0.GstPad:sink: caps = application/x-rtp, payload=(int)96, media=(string)video, clock-rate=(int)90000, encoding-name=(string)H264
Got message #2337 from element "filesink0" (state-changed): GstMessageStateChanged, old-state=(GstState)ready, new-state=(GstState)paused, pending-state=(GstState)void-pending;
Got message #2340 from element "pipeline0" (state-changed): GstMessageStateChanged, old-state=(GstState)ready, new-state=(GstState)paused, pending-state=(GstState)void-pending;
Pipeline is PREROLLED ...
Setting pipeline to PLAYING ...
Got message #2339 from element "pipeline0" (async-done): GstMessageAsyncDone, running-time=(guint64)18446744073709551615;
Got message #2341 from element "filesink0" (latency): no message details
Redistribute latency...
Got message #2342 from element "pipeline0" (new-clock): GstMessageNewClock, clock=(GstClock)"\(GstSystemClock\)\ GstSystemClock";
New clock: GstSystemClock
Got message #2344 from element "filesink0" (state-changed): GstMessageStateChanged, old-state=(GstState)paused, new-state=(GstState)playing, pending-state=(GstState)void-pending;
Got message #2345 from element "capsfilter1" (state-changed): GstMessageStateChanged, old-state=(GstState)paused, new-state=(GstState)playing, pending-state=(GstState)void-pending;
Got message #2347 from element "rtph264depay0" (state-changed): GstMessageStateChanged, old-state=(GstState)paused, new-state=(GstState)playing, pending-state=(GstState)void-pending;
Got message #2348 from element "capsfilter0" (state-changed): GstMessageStateChanged, old-state=(GstState)paused, new-state=(GstState)playing, pending-state=(GstState)void-pending;
Got message #2349 from element "pcapparse0" (state-changed): GstMessageStateChanged, old-state=(GstState)paused, new-state=(GstState)playing, pending-state=(GstState)void-pending;
Got message #2350 from element "filesrc0" (state-changed): GstMessageStateChanged, old-state=(GstState)paused, new-state=(GstState)playing, pending-state=(GstState)void-pending;
Got message #2351 from element "pipeline0" (state-changed): GstMessageStateChanged, old-state=(GstState)paused, new-state=(GstState)playing, pending-state=(GstState)void-pending;
Got message #31 from element "pipeline0" (eos): no message details
Got EOS from element "pipeline0".
Execution ended after 0:00:00.040522000
Setting pipeline to NULL ...
Freeing pipeline ...
- Using openh264dec decoder simply throws an unsupported error:
gst-launch-1.0 filesrc location=recording1.pcap ! pcapparse ! "application/x-rtp, payload=96" ! openh264dec ! filesink location=myfile.ts
WARNING: erroneous pipeline: could not link pcapparse0 to openh264dec0, openh264dec0 can't handle caps application/x-rtp, payload=(int)96
ffdec_h264 seems to be unsupported in all cases, and all tutorial or online examples using this option fail immediately.
Thank you