How to write h264 to the pipe without timestamp losing?
sonntex
sonntex at gmail.com
Thu Aug 4 11:37:48 UTC 2016
Hi!
I use gstreamer 1.8.2 to grab video from uvc camera to mp4 file.
Pipeline looks like:
gst-launch-1.0 -qe \
v4l2src device=/dev/video0 do-timestamp=true !
video/x-raw,width=640,height=480,framerate=30/1 \
! videoconvert \
! omxh264enc target-bitrate=524288 control-rate=variable !
video/x-h264,profile=baseline \
! h264parse \
! mp4mux \
! filesink location=video.mp4
But I need to split this pipeline into three parts using fdsink and fdsrc
elements like this:
gst-launch-1.0 -qe \
v4l2src device=/dev/video0 do-timestamp=true !
video/x-raw,width=640,height=480,framerate=30/1 \
! videoconvert \
! omxh264enc target-bitrate=524288 control-rate=variable !
video/x-h264,profile=baseline \
! h264parse config-interval=1 \
! mpegtsmux \
! fdsink \
|
gst-launch-1.0 -qe \
fdsrc \
! tsparse \
! tsdemux \
! h264parse \
! mp4mux \
! filesink location=video.mp4
In this case mp4 file is not playable. It contains packets with correct pts
value, but dts value is zero for all packets.
ffprobe -show_packets video.mp4 | grep "\[PACKET\]\|pts=\|dts=" | head -n 48
ffprobe version 2.8.6 Copyright (c) 2007-2016 the FFmpeg developers
built with gcc 4.9.3 (Gentoo 4.9.3 p1.5, pie-0.6.4)
configuration: --prefix=/usr --libdir=/usr/lib64 --shlibdir=/usr/lib64
--mandir=/usr/share/man --enable-shared --cc=x86_64-pc-linux-gnu-gcc
--cxx=x86_64-pc-linux-gnu-g++ --ar=x86_64-pc-linux-gnu-ar --optflags='-O2
-pipe' --disable-static --enable-avfilter --enable-avresample
--disable-stripping --disable-indev=v4l2 --disable-outdev=v4l2
--disable-indev=oss --disable-indev=jack --disable-outdev=oss
--disable-outdev=sdl --enable-bzlib --disable-runtime-cpudetect
--disable-debug --disable-doc --disable-gnutls --enable-gpl
--enable-hardcoded-tables --enable-iconv --disable-lzma --enable-network
--disable-openssl --enable-postproc --disable-libsmbclient --disable-ffplay
--disable-sdl --enable-vaapi --disable-vdpau --disable-xlib
--disable-libxcb --disable-libxcb-shm --disable-libxcb-xfixes --enable-zlib
--disable-libcdio --disable-libiec61883 --disable-libdc1394
--disable-libcaca --disable-openal --enable-opengl --disable-libv4l2
--disable-libpulse --disable-libopencore-amrwb --disable-libopencore-amrnb
--disable-libfdk-aac --disable-libopenjpeg --disable-libbluray
--disable-libcelt --disable-libgme --disable-libgsm --disable-libmodplug
--disable-libopus --disable-libquvi --disable-librtmp --disable-libssh
--disable-libschroedinger --disable-libspeex --disable-libvorbis
--disable-libvpx --disable-libzvbi --disable-libbs2b --disable-libflite
--disable-frei0r --disable-libfribidi --disable-fontconfig --disable-ladspa
--disable-libass --disable-libfreetype --disable-libsoxr --enable-pthreads
--disable-libvo-aacenc --disable-libvo-amrwbenc --disable-libmp3lame
--disable-libaacplus --disable-libfaac --disable-libsnappy
--disable-libtheora --disable-libtwolame --disable-libwavpack
--disable-libwebp --disable-libx264 --disable-libx265 --disable-libxvid
--disable-x11grab --disable-amd3dnow --disable-amd3dnowext --disable-fma4
--disable-xop
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41isomiso2
creation_time : 1970-01-01 01:24:58
Duration: 00:00:00.00, start: 0.000000, bitrate: N/A
Stream #0:0(eng): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p,
640x480, 10k tbn, 20k tbc (default)
Metadata:
creation_time : 1970-01-01 01:24:58
handler_name : VideoHandler
[PACKET]
pts=0
dts=0
[PACKET]
pts=5000
dts=0
[PACKET]
pts=5400
dts=0
[PACKET]
pts=5881
dts=0
[PACKET]
pts=6400
dts=0
[PACKET]
pts=6880
dts=0
[PACKET]
pts=7400
dts=0
[PACKET]
pts=7880
dts=0
[PACKET]
pts=8400
dts=0
[PACKET]
pts=8880
dts=0
[PACKET]
pts=9400
dts=0
[PACKET]
pts=9880
dts=0
[PACKET]
pts=10361
dts=0
[PACKET]
pts=10881
dts=0
[PACKET]
pts=11361
dts=0
[PACKET]
pts=11881
dts=0
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20160804/94889e2b/attachment.html>
More information about the gstreamer-devel
mailing list