My ffmpeg Option :
ffmpeg -i test.mp4 -max_delay 50000 -map 0:v -map 0:a -c copy -flags:v +global_header -bsf:v h264_mp4toannexb -f ssegment -segment_time 10 -segment_list playlist.m3u8 -segment_format mpegts -initial_offset 10 segment_%05d.ts
if the WIFI, .m3u8 file plays not loading.
if the 3G, the loading takes longer.
my Works :
.m3u8 URL : http://mytest/test/test.m3u8
Simply call this URL into browser
my Question is :
Question 1.
Can I split the HD video in .mp4 smaller capacity .ts files to .m3u8 file through the option of ffmpeg?
Question 2.
.m3u8 when you play there a set way of WIFI and 3G options for ffmpeg?
Answer1: Split your big HD mp4 file to smaller ts segments using ffmpeg command as
ffmpeg -i test.mp4 -max_delay 50000 -map 0 -f segment -segment_time 1 -segment_list_flags live -segment_list_size 6 -segment_wrap 0 -segment_list playlist.m3u8 -segment_format mpegts segment_%05d.ts
Answer2: For playing ts streams on iPad or iPhone devices, transcode it to baseline profile using libx264
ffmpeg -i test.mp4 -max_delay 50000 -map 0 -c copy -c:v libx264 -profile:v baseline -flags -global_header -f segment -segment_time 1 -segment_list_flags live -segment_list_size 6 -segment_wrap 0 -segment_list playlist.m3u8 -segment_format mpegts segment_%05d.ts
Related
I'm trying to re-stream an M3U8 stream to an rtmp server but I'm often seeing this:
Skipping 1 segments ahead, expired from playlists
This causes the output stream playback to pause and lag after a while.
I'm using the following ffmpeg command:
ffmpeg -stream_loop -1 -thread_queue_size 8192 -i http://demo.m3u8 -c:a aac -c:v h264 -ar 44100 -vf scale=640:-1 -hide_banner -bf 0 -pix_fmt yuv420p -vprofile baseline -preset superfast -segment_list_flags live -segment_list_size 300 -segment_time 300 -hls_list_size 300 -hls_time 300 -flvflags no_duration_filesize -f flv rtmp://myserver
Is there a way to prevent this issue to ensure a smooth playback?
I've already tried to create HLS stream from a UDP continuous input stream, it was fairly easy, now I want to create a simulated live HLS stream from multiple MP4 sources with ffmpeg, the idea behind it is to be able to create a TV channel with non-live data, so the input must be a loop of non-live data to simulate live stream continuity. I tried to do it with the below command but after the first round, ffmpeg exits with this error:
concat:1.mp4|2.mp4|3.mp4" Resource temporarily unavailable.
ffmpeg command:
ffmpeg -i "concat:1.mp4|2.mp4|3.mp4" -strict experimental -sn -ac 2 -map_metadata -1 -s 720x576 -g 250 -c:v libx264 -pix_fmt yuv420p -flags -global_header -hls_time 10 -hls_list_size 5 -hls_wrap 12 -hls_flags delete_segments -f hls -strftime 1 -segment_time 10 -segment_format mpegts -segment_list_flags +live -hls_allow_cache 0 -segment_wrap 12 -segment_list_size 5 -hls_base_url http://192.168.1.100/0/ -hls_segment_filename /data/0/live_0_%02d.ts /data/0/live_0.m3u8
If anyone has a nice solution to this issue, I would appreciate any input.
Cheers,
Navid
I was using the following command for recording input streams to mp4 into 10 seconds clip. But since few days there is no voice in the output mp4 clips.
Command is
ffmpeg -i rtsp://localhost:8554/mystream -c copy -bsf:a aac_adtstoasc -f segment -segment_time 10 -reset_timestamps 1 -map 0 output%d.mp4
ffmpeg output
I think its because of the format of input stream but i don't know for sure and also, i don't know how to solve it.
I solved it using the following command.
ffmpeg -i rtsp://localhost:8554/mystream -c:a aac -c:v copy -bsf:a aac_adtstoasc -f segment -segment_time 10 -reset_timestamps 1 -map 0 output%d.mp4
changing -c to -c:a aac -c:v
I have setup a HLS live stream on AWS. Significant part of the video plays as expected but in some portions audio is lost while the video continues to play. Please share you thoughts/insights if you have faced such an issue.
I transcode video to h264, baseline3.1 and audio to aac stereo 2 channels before segmenting to 10s files. Following commands are being used:
Transcoding:
ffmpeg -y -i ${file_path} -b:v ${vBitrate} -minrate ${vBitrate} -maxrate ${vBitrate} -c:v libx264 -b:a ${aBitrate} -c:a libfaac -ac 2 -r 25 -s ${resolution} -profile:v baseline -level 3.1 ${output_dir}/${file_name}.ts
Ex: vBitrate: 1m, aBirate: 128k, resolution: 960x540
Splittting:
ffmpeg -i ${file_path} -c:v copy -c:a copy -flags -global_header -map 0 -f segment -segment_time ${segment} -segment_list ${output_dir}/playlist.m3u8 -segment_format mpegts tmp0/${file_name}_%02d.ts
Ex: segment: 10
Setup: segments are being served from Nginx and playlist is managed by a Python/Flask app.
I'm using FFMpeg to segment a WAV file into mp3s for use in HTTP Live Streaming.
I'm using this command:
ffmpeg -i input.wav -c:a libmp3lame -b:a 128k -map 0:0 -f segment
-segment_time 10 -segment_list outputlist.m3u8 -segment_format mp3 'output%03d.mp3'
The stream is working, however I'm getting small "gaps" between each mp3 segment. Why is this?
I was able to solve this by using -segment_format mpegts.
ffmpeg -i input.wav -c:a libmp3lame -b:a 128k -map 0:0 -f segment -segment_time 10 -segment_list outputlist.m3u8 -segment_format mpegts 'output%03d.mp3'