
Recherche avancée
Autres articles (72)
-
Des sites réalisés avec MediaSPIP
2 mai 2011, parCette page présente quelques-uns des sites fonctionnant sous MediaSPIP.
Vous pouvez bien entendu ajouter le votre grâce au formulaire en bas de page. -
Support audio et vidéo HTML5
10 avril 2011MediaSPIP utilise les balises HTML5 video et audio pour la lecture de documents multimedia en profitant des dernières innovations du W3C supportées par les navigateurs modernes.
Pour les navigateurs plus anciens, le lecteur flash Flowplayer est utilisé.
Le lecteur HTML5 utilisé a été spécifiquement créé pour MediaSPIP : il est complètement modifiable graphiquement pour correspondre à un thème choisi.
Ces technologies permettent de distribuer vidéo et son à la fois sur des ordinateurs conventionnels (...) -
HTML5 audio and video support
13 avril 2011, parMediaSPIP uses HTML5 video and audio tags to play multimedia files, taking advantage of the latest W3C innovations supported by modern browsers.
The MediaSPIP player used has been created specifically for MediaSPIP and can be easily adapted to fit in with a specific theme.
For older browsers the Flowplayer flash fallback is used.
MediaSPIP allows for media playback on major mobile platforms with the above (...)
Sur d’autres sites (7928)
-
ffmpeg - Build HLS stream with all tracks of the input source
25 juillet 2021, par Kaydee DunlopI would like to create HLS streams for videos. I'm working since more than 2 days now to find a solution that might work but no luck till now to get all tracks of the input inside my HLS output.


What I want in the end is a small script that can merge all tracks form a mp4 imput together and create a proper master.m3u8 playlist referencing all other m3u8 playlists of my m4s, webvtt and audio snippets. Currently I don't have adaptive streaming implemented. To save bandwidth I only want to have one video stream output at a max resolution of 1080p @ 3 Mbit/s.


This is my current state of work, please feel free to to use it :


#!/usr/bin/env bash
LC_NUMERIC="en_US.UTF-8"
START_TIME=$SECONDS
set -e

echo "-----START GENERATING HLS STREAM-----"
# Usage create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]
[[ ! "${1}" ]] && echo "Usage: create-vod-hls.sh SOURCE_FILE [OUTPUT_NAME]" && exit 1

# comment/add lines here to control which renditions will be created
renditions=(
# resolution bitrate audio-rate
 "1920x1080 3000k 128k"
)

segment_target_duration=20 # try to create a new segment every 10 seconds
max_bitrate_ratio=1.07 # maximum accepted bitrate fluctuations
rate_monitor_buffer_ratio=1.5 # maximum buffer size between bitrate conformance checks

#########################################################################

source="${1}"
target="${2}"
if [[ ! "${target}" ]]; then
 target="${source##*/}" # leave only last component of path
 target="${target%.*}" # strip extension
fi
mkdir -p ${target}

# ----CUSTOM----
sourceResolution="$(ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=s=x:p=0 ${source})"
# echo ${sourceResolution}
arrIN=(${sourceResolution//x/ })
sourceWidth="${arrIN[0]}"
sourceHeight="${arrIN[1]}"

echo ${sourceWidth}
echo ${sourceHeight}

sourceAudioBitRate="$(ffprobe -v error -select_streams a:0 -show_entries stream=bit_rate -of csv=s=x:p=0 ${source})"
sourceAudioBitRateFormatted=$((sourceAudioBitRate / 1000))
# ----END CUSTOM----

key_frames_interval="$(echo `ffprobe ${source} 2>&1 | grep -oE '[[:digit:]]+(.[[:digit:]]+)? fps' | grep -oE '[[:digit:]]+(.[[:digit:]]+)?'`*2 | bc || echo '')"
key_frames_interval=${key_frames_interval:-50}
key_frames_interval=$(echo `printf "%.1f\n" $(bc -l <<<"$key_frames_interval/10")`*10 | bc) # round
key_frames_interval=${key_frames_interval%.*} # truncate to integer

# static parameters that are similar for all renditions
static_params="-c:s webvtt -c:a aac -ar 48000 -c:v copy -sc_threshold 0"
static_params+=" -g ${key_frames_interval} -keyint_min ${key_frames_interval} -hls_time ${segment_target_duration}"
static_params+=" -hls_playlist_type vod -hls_segment_type fmp4"
static_params+=" -var_stream_map v:0,a:0,s:0"

# misc params
misc_params="-hide_banner -y"

master_playlist="#EXTM3U
#EXT-X-VERSION:3
"
cmd=""
resolutionValid=0
prevHeight=0
for rendition in "${renditions[@]}"; do
 # drop extraneous spaces
 rendition="${rendition/[[:space:]]+/ }"

 # rendition fields
 resolution="$(echo ${rendition} | cut -d ' ' -f 1)"
 bitrate="$(echo ${rendition} | cut -d ' ' -f 2)"
 audiorate="$(echo ${rendition} | cut -d ' ' -f 3)"

 audioBitRateFormatted=${audiorate%?} # remove "k" at the last index

 # take highest possible audio bit rate
 if [ $audioBitRateFormatted -gt $sourceAudioBitRateFormatted ]; then
 audiorate=${sourceAudioBitRateFormatted}k
 fi

 # calculated fields
 width="$(echo ${resolution} | grep -oE '^[[:digit:]]+')"
 height="$(echo ${resolution} | grep -oE '[[:digit:]]+$')"
 maxrate="$(echo "`echo ${bitrate} | grep -oE '[[:digit:]]+'`*${max_bitrate_ratio}" | bc)"
 bufsize="$(echo "`echo ${bitrate} | grep -oE '[[:digit:]]+'`*${rate_monitor_buffer_ratio}" | bc)"
 bandwidth="$(echo ${bitrate} | grep -oE '[[:digit:]]+')000"
 name="stream"
 
 widthParam=0
 heightParam=0

 if [ $(((width / sourceWidth) * sourceHeight)) -gt $height ]; then
 widthParam=-2
 heightParam=$height
 else
 widthParam=$width
 heightParam=-2
 fi
 
 #cmd+=" ${static_params} -vf scale=w=${widthParam}:h=${heightParam}"
 cmd+=" -b:v ${bitrate} -maxrate ${maxrate%.*}k -bufsize ${bufsize%.*}k -b:a ${audiorate}"
 cmd+=" -hls_segment_filename ${target}/${name}_%03d.m4s ${target}/${name}.m3u8"
 
 # add rendition entry in the master playlist
 master_playlist+="#EXT-X-STREAM-INF:BANDWIDTH=${bandwidth},RESOLUTION=${resolution}\n${name}.m3u8\n"

 resolutionValid=1
 prevHeight=${height}
done

if [ $resolutionValid -eq 1 ]; then
 # start conversion
 echo -e "Executing command:\nffmpeg ${misc_params} -i ${source} ${cmd}\n"
 ffmpeg ${misc_params} -i ${source} ${cmd}
 # create master playlist file
 echo -e "${master_playlist}" > ${target}/playlist.m3u8
 echo "Done - encoded HLS is at ${target}/"
else
 echo "Video source is too small"
 exit 1
fi

ELAPSED_TIME=$(($SECONDS - $START_TIME))

echo "Elapsed time: ${ELAPSED_TIME}"
echo "-----FINISH GENERATING HLS STREAM-----"



-
When downloading HLS video with FFMPEG it does not download the audio
3 août 2021, par Thiago FranklinI have a problem, when I try to download an HLS video with FFMPEG, it downloads the video track, but it doesn't find the AUDIO. When running the HLS .m3u8 file in a player, it plays normally, audio and video, but when trying to download, it shows an error message saying that the audio cannot be found.


I'm running the following command :


ffmpeg.exe -i "https://teste-etv.espiritismo.tv/437602.m3u8" -codec:a libmp3lame -b:a 96k teste-hls.mp3


Displays the following error when trying to download the audio :


[hls @ 0000021b5d9ad940] Skip ('#EXT-X-VERSION:3')
[hls @ 0000021b5d9ad940] Skip ('#EXT-X-INDEPENDENT-SEGMENTS')
[hls @ 0000021b5d9ad940] Opening 'https://appsetv.b-cdn.net/hls/437602/437602-1080p.m3u8' for reading
[hls @ 0000021b5d9ad940] Skip ('#EXT-X-VERSION:3')
[https @ 0000021b5e10ee00] Opening 'https://appsetv.b-cdn.net/hls/437602/437602-720p.m3u8' for reading
[hls @ 0000021b5d9ad940] Skip ('#EXT-X-VERSION:3')
[https @ 0000021b5e10ee00] Opening 'https://appsetv.b-cdn.net/hls/437602/437602-540p.m3u8' for reading
[hls @ 0000021b5d9ad940] Skip ('#EXT-X-VERSION:3')
[https @ 0000021b5e10ee00] Opening 'https://appsetv.b-cdn.net/hls/437602/437602-360p.m3u8' for reading
[hls @ 0000021b5d9ad940] Skip ('#EXT-X-VERSION:3')
[hls @ 0000021b5d9ad940] Opening 'https://appsetv.b-cdn.net/hls/437602/437602-1080p_00001.ts' for reading
[hls @ 0000021b5d9ad940] Opening 'https://appsetv.b-cdn.net/hls/437602/437602-1080p_00002.ts' for reading
[hls @ 0000021b5d9ad940] Opening 'https://appsetv.b-cdn.net/hls/437602/437602-720p_00001.ts' for reading
[hls @ 0000021b5d9ad940] Opening 'https://appsetv.b-cdn.net/hls/437602/437602-720p_00002.ts' for reading
[hls @ 0000021b5d9ad940] Opening 'https://appsetv.b-cdn.net/hls/437602/437602-540p_00001.ts' for reading
[hls @ 0000021b5d9ad940] Opening 'https://appsetv.b-cdn.net/hls/437602/437602-540p_00002.ts' for reading
[hls @ 0000021b5d9ad940] Opening 'https://appsetv.b-cdn.net/hls/437602/437602-360p_00001.ts' for reading
[hls @ 0000021b5d9ad940] Opening 'https://appsetv.b-cdn.net/hls/437602/437602-360p_00002.ts' for reading
[hls @ 0000021b5d9ad940] Could not find codec parameters for stream 1 (Audio: aac ([15][0][0][0] / 0x000F), 0 channels, fltp): unspecified sample rate
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[hls @ 0000021b5d9ad940] Could not find codec parameters for stream 3 (Audio: aac ([15][0][0][0] / 0x000F), 0 channels, fltp): unspecified sample rate
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[hls @ 0000021b5d9ad940] Could not find codec parameters for stream 5 (Audio: aac ([15][0][0][0] / 0x000F), 0 channels, fltp): unspecified sample rate
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[hls @ 0000021b5d9ad940] Could not find codec parameters for stream 7 (Audio: aac ([15][0][0][0] / 0x000F), 0 channels, fltp): unspecified sample rate
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, hls, from 'https://appsetv.b-cdn.net/hls/437602/437602.m3u8':
 Duration: 00:01:41.00, start: 2.083333, bitrate: 0 kb/s
 Program 0
 Metadata:
 variant_bitrate : 2509173
 Stream #0:0: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], 24 fps, 24 tbr, 90k tbn, 48 tbc
 Metadata:
 variant_bitrate : 2509173
 Stream #0:1: Audio: aac ([15][0][0][0] / 0x000F), 0 channels, fltp
 Metadata:
 variant_bitrate : 2509173
 Program 1
 Metadata:
 variant_bitrate : 1205957
 Stream #0:2: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 24 fps, 24 tbr, 90k tbn, 48 tbc
 Metadata:
 variant_bitrate : 1205957
 Stream #0:3: Audio: aac ([15][0][0][0] / 0x000F), 0 channels, fltp
 Metadata:
 variant_bitrate : 1205957
 Program 2
 Metadata:
 variant_bitrate : 1165600
 Stream #0:4: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 960x540 [SAR 1:1 DAR 16:9], 24 fps, 24 tbr, 90k tbn, 48 tbc
 Metadata:
 variant_bitrate : 1165600
 Stream #0:5: Audio: aac ([15][0][0][0] / 0x000F), 0 channels, fltp
 Metadata:
 variant_bitrate : 1165600
 Program 3
 Metadata:
 variant_bitrate : 656245
 Stream #0:6: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 640x360 [SAR 1:1 DAR 16:9], 24 fps, 24 tbr, 90k tbn, 48 tbc
 Metadata:
 variant_bitrate : 656245
 Stream #0:7: Audio: aac ([15][0][0][0] / 0x000F), 0 channels, fltp
 Metadata:
 variant_bitrate : 656245
Output #0, mp3, to 'teste-hls.mp3':
Output file #0 does not contain any stream



-
add full screen image to mp4 by ffmpeg
7 septembre 2021, par qbhti want to add a 1920 x 1080 image to 720p and 1080p video from 0 to 5 second (source will be different resolution) and add another image same resoltion to second 10to15 second and another image to 20 to 25 socond


i used


ffmpeg -i 1080.mp4 -i id1.png -i id2.png -i id3.png -map_metadata -1
-s hd720 -c:v h264 \
-crf 26 \
-c:a aac -b:a 128k -strict -2 \
-preset veryfast \
-filter_complex \ "[0:v][1:v] overlay=0:0:enable='between(t,0,5)' [tmp]; \ [tmp][2:v] overlay=0:0:enable='between(t,10,15)'[tmp];\
[tmp][3:v] overlay=0:0:enable='between(t,20,25)'" \ 720p.mp4



issue is source size i dont know how to use
scale2ref=w=oh*mdar:h=ih*1.0
in my code