Skip to content

Instantly share code, notes, and snippets.

View matiaspl's full-sized avatar

Mateusz Starzak matiaspl

  • Amagi & Lodz University of Technology
  • Lodz, Poland
View GitHub Profile
@matiaspl
matiaspl / gist:23248eedc23b0890b8cadc59dc9a62c3
Last active November 5, 2023 21:00
gstreamer pipelines with Intel HW acceleration

TS: VAAPI H264 to H265 transcode with deinterlacing

gst-launch-1.0 --gst-debug=2 -ev mpegtsmux name="mux"
souphttpsrc location=http://stream/url ! parsebin ! queue ! vaapih264dec ! vaapipostproc deinterlace-mode=1 deinterlace-method=4 width=1280 height=720 ! vaapih265enc rate-control=vbr bitrate=2000 keyframe-period=50 max-bframes=0 quality-level=4 ! video/x-h265,stream-format=hvc1 ! queue ! h265parse config-interval=1 ! video/x-h265,alignment=au,stream-format=byte-stream ! mux. tcpserversink host=0.0.0.0 port=1234

TS: audio transcode

gst-launch-1.0 --gst-debug=2 -ev souphttpsrc location=http://stream/url ! tsparse ! tsdemux ! queue ! flump3dec ! audioconvert ! avenc_aac ! aacparse ! mpegtsmux ! tcpserversink host=0.0.0.0 port=1234

TS: audio remux

@matiaspl
matiaspl / gist:2a5775d13249d21da465e667c59e6d83
Last active May 23, 2016 11:09
Convert a bunch of MTS files from a camera to a sort-of-HTML5-compatible MP4's (while keeping the directory structure)
find /base_folder -name "*.MTS" -exec sh -c 'ffmpeg -n -i "$0" -c:v copy -c:a libfdk_aac "`basename "$0" .MTS`.mp4"' '{}' \;
Note:
The video track in the original MTS files most likely are H.264 High Profile, so they are not mobile-friendly.
Beware that the resulting MP4's may not play on older devices mobile. Change the base_folder according to your needs.