Can anyone advise on how to construct an MP4
file from an HLS
stream (the reverse of what you usually want)? Say I have the m3u8 - is there a straightforward way of getting a single MP4
using FFMPEG
or some other tool?
ffmpeg -i in.m3u8 -acodec copy -vcodec copy out.mp4
For AAC audio you will also need to add the the bit ststream filter. (Thanks @aergistal for pointing that out)
ffmpeg -i in.m3u8 -acodec copy -bsf:a aac_adtstoasc -vcodec copy out.mp4
An alternative way of converting an HLS to MP4 is using VLC Player. You can do the conversion through the interface as well as commandline. Simply you can run a .bat
file which has following lines:
chcp 65001
"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" http://cdn.haramain.global/vods3/_definst_/mp4:amazons3/akra/programlar/yeni/335/c07f21e3-a313-4e8d-b594-403ddefbf11f.mp4/playlist.m3u8 --sout "#transcode{vcodec=none,acodec=mp3,ab=70,channels=2,samplerate=44100}:std{access=file{no-overwrite},mux=mp3,dst='C:\Users\aidata\Desktop\Akra FM\13.07.2013 - Karagöz - Bilmecesi.mp3'}" vlc://quit
"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe" http://cdn.haramain.global/vods3/_definst_/mp4:amazons3/akra/programlar/yeni/335/dcb6754a-49f1-4517-bfe4-3864942f63c8.mp4/playlist.m3u8 --sout "#transcode{vcodec=none,acodec=mp3,ab=70,channels=2,samplerate=44100}:std{access=file{no-overwrite},mux=mp3,dst='C:\Users\aidata\Desktop\Akra FM\12.07.2013 - Nasreddin Hoca - Köyün Eseği.mp3'}" vlc://quit
This batch script converts two files one after another. If you had pasted these commands into cmd.exe, all conversions would start at the same time.
Now let me explain the codes. The chcp 65001
line allows you to use unicode characters in the destination file name. Following lines consist of four parts.
"C:\Program Files (x86)\VideoLAN\VLC\vlc.exe"
This is the path of the VLC player. Verify this after installing VLC player.
http://cdn.haramain.global/vods3/_definst_/mp4:amazons3/akra/programlar/yeni/335/c07f21e3-a313-4e8d-b594-403ddefbf11f.mp4/playlist.m3u8
This is a sample HLS file. I don't know what happens if you put this link in double quotes.
--sout "#transcode{vcodec=none,acodec=mp3,ab=70,channels=2,samplerate=44100}:std{access=file{no-overwrite},mux=mp3,dst='C:\Users\aidata\Desktop\Akra FM\13.07.2013 - Karagöz - Bilmecesi.mp3'}"
This is the VLC command for conversion. You can find more options in VLC Documentation
vlc://quit
This will close the VLC window. It is helpful if you don't want your taskbar to be filled with VLC windows. There is no way to stack conversion orders in playlist. You have to run VLC, do the conversion and close the window. You can also try running VLC in silent mode. Or you can drag a VLC window to right bottom of your screen so that subsquent flashing windows won't disturb you.
© 2022 - 2024 — McMap. All rights reserved.
ffmpeg -i in.m3u8 -acodec copy -vcodec copy out.mp4
– Numberless-bsf:a aac_adtstoasc
– Maryellen