Last active
March 4, 2020 20:03
-
-
Save LeeiFrankJaw/98ab543a0da2f48993ebfca44ad68bf6 to your computer and use it in GitHub Desktop.
Convert HLS stream from m3u8 to MP4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Convert HLS stream from m3u8 to MP4 | |
gst-launch-1.0 -v mp4mux name=mux ! filesink location=output.mp4 filesrc location=GOPR7003.m3u8 ! hlsdemux ! decodebin name=decoder decoder. ! queue ! videoconvert ! x264enc ! mux. decoder. ! queue ! audioconvert ! voaacenc ! mux. | |
# Combine normal TS files into MP4 | |
cvlc -v segment-*.ts \ | |
--sout='#gather:file{dst=output.mp4}' \ | |
--sout-keep \ | |
'vlc://quit' | |
# The above approach will probably produce imperfect output. | |
cat segment-*.ts | ffmpeg -i - -acodec copy -vcodec copy output.mp4 | |
# Presumably better than previous method. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment