Saving raw h264 packets

john.ocallaghan at accenture.com john.ocallaghan at accenture.com
Tue Apr 25 15:25:17 UTC 2017




Hi All

I am using the following command to extract video h264 packets from my rtsp stream:
gst-launch-1.0 rtspsrc location="rtsp://MY_BIG_BUCK_BUNNY_IPADDRESS/vod/sample.mp4" ! queue ! "application/x-rtp,media=video" ! rtph264depay ! h264parse ! filesink location="test.h264"

To test my pipe and the format of the h264 packets I give that file to ffmpeg to create an mp4 :
ffmpeg -f h264 -i test.h264 -vcodec copy test.mp4

FFmpg complains trying the above command saying it cant find frames, start codes and eventually bombs out with
“Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument”
The entire output is below.

If I add a matroskamux to the gstreamer pipe I am able to play the output file no probs.
Is there something special about the h264 raw output packets generated from the gst-launch command?

Looking at the raw h264 output file it looks to me like there are extra bytes of data (maybe 35bytes ?) in front of the first h264 packet. But I could be way off with that. And following packets seem to have an offset counter that’s incrementing  (eg 00000001 … 0000008F).

Can anyone out there help me to get the output h264 raw file into a format that can be read by ffmpeg?

Many (many many!) thanks
John


$ ffmpeg -f h264 -i test.h264 -vcodec copy test.mp4
ffmpeg version 3.1.4 Copyright (c) 2000-2016 the FFmpeg developers
  built with Apple LLVM version 8.0.0 (clang-800.0.38)
  configuration: --prefix=/usr/local/Cellar/ffmpeg/3.1.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-opencl --enable-libx264 --enable-libmp3lame --enable-libxvid --disable-lzma --enable-vda
  libavutil      55. 28.100 / 55. 28.100
  libavcodec     57. 48.101 / 57. 48.101
  libavformat    57. 41.100 / 57. 41.100
  libavdevice    57.  0.101 / 57.  0.101
  libavfilter     6. 47.100 /  6. 47.100
  libavresample   3.  0.  0 /  3.  0.  0
  libswscale      4.  1.100 /  4.  1.100
  libswresample   2.  1.100 /  2.  1.100
  libpostproc    54.  0.100 / 54.  0.100
[h264 @ 0x7fb4fa008600] missing picture in access unit with size 1055
[h264 @ 0x7fb4fa008600] data partitioning is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[h264 @ 0x7fb4fa008600] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. (ffmpeg-devel at ffmpeg.org<mailto:ffmpeg-devel at ffmpeg.org>)
[h264 @ 0x7fb4fa008600] no frame!
[h264 @ 0x7fb4fa008600] log2_max_frame_num_minus4 out of range (0-12): 50
[h264 @ 0x7fb4fa008600] missing picture in access unit with size 2030
[h264 @ 0x7fb4fa008600] Invalid NAL unit 2, skipping.
[h264 @ 0x7fb4fa008600] data partitioning is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[h264 @ 0x7fb4fa008600] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. (ffmpeg-devel at ffmpeg.org<mailto:ffmpeg-devel at ffmpeg.org>)
[h264 @ 0x7fb4fa008600] no frame!
[h264 @ 0x7fb4fa008600] missing picture in access unit with size 63108
[h264 @ 0x7fb4fa008600] Invalid NAL unit 2, skipping.
    Last message repeated 1 times
[h264 @ 0x7fb4fa008600] Invalid NAL unit 29, skipping.
[h264 @ 0x7fb4fa008600] no frame!
[h264 @ 0x7fb4fa008600] sps_id 24 out of range
[h264 @ 0x7fb4fa008600] non-existing PPS 0 referenced
[h264 @ 0x7fb4fa008600] Invalid NAL unit 16, skipping.
    Last message repeated 2 times
[h264 @ 0x7fb4fa008600] No start code is found.
[h264 @ 0x7fb4fa008600] Error splitting the input into NAL units.
[h264 @ 0x7fb4f8800000] decoding for stream 0 failed
[h264 @ 0x7fb4f8800000] Could not find codec parameters for stream 0 (Video: h264, none): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, h264, from 'test.h264':
  Duration: N/A, bitrate: N/A
    Stream #0:0: Video: h264, none, 37.50 fps, 25 tbr, 1200k tbn, 50 tbc
File 'test.mp4' already exists. Overwrite ? [y/N] y
[mp4 @ 0x7fb4f8800600] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
[mp4 @ 0x7fb4f8800600] dimensions not set
Output #0, mp4, to 'test.mp4':
    Stream #0:0: Video: h264, none, q=2-31, 37.50 fps, 25 tbr, 1200k tbn, 1200k tbc
Stream mapping:
  Stream #0:0 -> #0:0 (copy)
Could not write header for output file #0 (incorrect codec parameters ?): Invalid argument


________________________________

This message is for the designated recipient only and may contain privileged, proprietary, or otherwise confidential information. If you have received it in error, please notify the sender immediately and delete the original. Any other use of the e-mail by you is prohibited. Where allowed by local law, electronic communications with Accenture and its affiliates, including e-mail and instant messaging (including content), may be scanned by our systems for the purposes of information security and assessment of internal compliance with Accenture policy.
______________________________________________________________________________________

www.accenture.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20170425/27fea59a/attachment-0001.html>


More information about the gstreamer-devel mailing list