make playlist more simple
This commit is contained in:
parent
02f4bf08fe
commit
f92a43cb33
@ -1,16 +1,17 @@
|
||||
<smil>
|
||||
<head>
|
||||
<meta name="author" content="Author"/>
|
||||
<meta name="title" content="Title"/>
|
||||
<meta name="copyright" content="(c)2018 company"/>
|
||||
<playlist>
|
||||
<head>
|
||||
<meta name="author" content="example"/>
|
||||
<meta name="title" content="Live Stream"/>
|
||||
<meta name="copyright" content="(c)2018 example.org"/>
|
||||
<meta name="date" content="2018-02-03"/>
|
||||
</head>
|
||||
<body>
|
||||
<video src="/path/clip_01.mkv" clipBegin="21600s" dur="18.000000s" in="0.00" out="18.000000s"/>
|
||||
<video src="/path/clip_02.mkv" clipBegin="21618s" dur="18.111000s" in="0.00" out="18.111000s"/>
|
||||
<video src="/path/clip_03.mkv" clipBegin="21636.1s" dur="247.896000s" in="0.00" out="247.896000s"/>
|
||||
<video src="/path/clip_04.mkv" clipBegin="21884s" dur="483.114000s" in="0.00" out="483.114000s"/>
|
||||
<video src="/path/clip_05.mkv" clipBegin="22367.1s" dur="20.108000s" in="0.00" out="20.108000s"/>
|
||||
<video src="/path/clip & specials.mkv" clipBegin="22387.2s" dur="203.290000s" in="0.00" out="203.290000s"/>
|
||||
<video src="/path/clip_06.mkv" clipBegin="22590.5s" dur="335.087000s" in="300.00" out="335.087000s"/>
|
||||
</body>
|
||||
</smil>
|
||||
<video src="/path/clip_01.mkv" begin="21600" dur="18.000000" in="0.00" out="18.000000"/>
|
||||
<video src="/path/clip_02.mkv" begin="21618" dur="18.111000" in="0.00" out="18.111000"/>
|
||||
<video src="/path/clip_03.mkv" begin="21636.1" dur="247.896000" in="0.00" out="247.896000"/>
|
||||
<video src="/path/clip_04.mkv" begin="21884" dur="483.114000" in="0.00" out="483.114000"/>
|
||||
<video src="/path/clip_05.mkv" begin="22367.1" dur="20.108000" in="0.00" out="20.108000"/>
|
||||
<video src="/path/clip & specials.mkv" begin="22387.2" dur="203.290000" in="0.00" out="203.290000"/>
|
||||
<video src="/path/clip_06.mkv" begin="22590.5" dur="335.087000" in="300.00" out="335.087000"/>
|
||||
</body>
|
||||
</playlist>
|
||||
|
30
README.md
30
README.md
@ -28,22 +28,23 @@ XML Playlist Example
|
||||
-----
|
||||
|
||||
```xml
|
||||
<smil>
|
||||
<head>
|
||||
<meta name="author" content="Author"/>
|
||||
<meta name="title" content="Title"/>
|
||||
<meta name="copyright" content="(c)2018 company"/>
|
||||
<playlist>
|
||||
<head>
|
||||
<meta name="author" content="example"/>
|
||||
<meta name="title" content="Live Stream"/>
|
||||
<meta name="copyright" content="(c)2018 example.org"/>
|
||||
<meta name="date" content="2018-02-03"/>
|
||||
</head>
|
||||
<body>
|
||||
<video src="/path/clip_01.mkv" clipBegin="21600s" dur="18.000000s" in="0.00" out="18.000000s"/>
|
||||
<video src="/path/clip_02.mkv" clipBegin="21618s" dur="18.111000s" in="0.00" out="18.111000s"/>
|
||||
<video src="/path/clip_03.mkv" clipBegin="21636.1s" dur="247.896000s" in="0.00" out="247.896000s"/>
|
||||
<video src="/path/clip_04.mkv" clipBegin="21884s" dur="483.114000s" in="0.00" out="483.114000s"/>
|
||||
<video src="/path/clip_05.mkv" clipBegin="22367.1s" dur="20.108000s" in="0.00" out="20.108000s"/>
|
||||
<video src="/path/clip & specials.mkv" clipBegin="22387.2s" dur="203.290000s" in="0.00" out="203.290000s"/>
|
||||
<video src="/path/clip_06.mkv" clipBegin="22590.5s" dur="335.087000s" in="300.00" out="335.087000s"/>
|
||||
</body>
|
||||
</smil>
|
||||
<video src="/path/clip_01.mkv" begin="21600" dur="18.000000" in="0.00" out="18.000000"/>
|
||||
<video src="/path/clip_02.mkv" begin="21618" dur="18.111000" in="0.00" out="18.111000"/>
|
||||
<video src="/path/clip_03.mkv" begin="21636.1" dur="247.896000" in="0.00" out="247.896000"/>
|
||||
<video src="/path/clip_04.mkv" begin="21884" dur="483.114000" in="0.00" out="483.114000"/>
|
||||
<video src="/path/clip_05.mkv" begin="22367.1" dur="20.108000" in="0.00" out="20.108000"/>
|
||||
<video src="/path/clip & specials.mkv" begin="22387.2" dur="203.290000" in="0.00" out="203.290000"/>
|
||||
<video src="/path/clip_06.mkv" begin="22590.5" dur="335.087000" in="300.00" out="335.087000"/>
|
||||
</body>
|
||||
</playlist>
|
||||
```
|
||||
|
||||
Installation
|
||||
@ -68,4 +69,3 @@ TODO
|
||||
- check empty playlist
|
||||
- check when clip or playlist got lost while playling (?)
|
||||
- add support for clip out point, in playlist
|
||||
- make playlist more simple - we don't need a smil like way...
|
||||
|
@ -239,8 +239,8 @@ def gen_dummy(duration):
|
||||
# if the new duration is smaller then 6 sec put a blank clip
|
||||
def prepare_last_clip(in_node, start):
|
||||
clip_path = in_node.get('src')
|
||||
clip_len = float(in_node.get('dur').rstrip('s'))
|
||||
clip_in = float(in_node.get('in').rstrip('s'))
|
||||
clip_len = float(in_node.get('dur'))
|
||||
clip_in = float(in_node.get('in'))
|
||||
tmp_dur = clip_len - clip_in
|
||||
current_time = get_time('full_sec')
|
||||
|
||||
@ -290,8 +290,8 @@ def iter_src_commands():
|
||||
# all clips in playlist except last one
|
||||
for clip_node in clip_nodes[:-1]:
|
||||
clip_path = clip_node.get('src')
|
||||
clip_start = float(clip_node.get('clipBegin').rstrip('s'))
|
||||
clip_len = float(clip_node.get('dur').rstrip('s'))
|
||||
clip_start = float(clip_node.get('begin'))
|
||||
clip_len = float(clip_node.get('dur'))
|
||||
|
||||
if seek:
|
||||
# first time we end up here
|
||||
|
@ -27,23 +27,26 @@ playlist="$listDate.xml"
|
||||
# start time in seconds
|
||||
listStart="21600"
|
||||
|
||||
[[ -d "$trunk" ]] || mkdir -p "$trunk"
|
||||
|
||||
# build Head for playlist
|
||||
printf '<smil>\n\t<head>
|
||||
<meta name="author" content="Author"/>
|
||||
<meta name="title" content="Titel"/>
|
||||
<meta name="copyright" content="(c)%s company"/>
|
||||
</head>\n\t<body>\n' "$(date +%Y)" >> "$trunk/$playlist"
|
||||
printf '<playlist>\n\t<head>
|
||||
<meta name="author" content="example"/>
|
||||
<meta name="title" content="Live Stream"/>
|
||||
<meta name="copyright" content="(c)%s example.org"/>
|
||||
<meta name="date" content="%s"/>
|
||||
</head>\n\t<body>\n' $(date +%Y) $listDate > "$trunk/$playlist"
|
||||
|
||||
# read playlist
|
||||
while read -r line; do
|
||||
clipPath=$(echo "$line" | sed 's/&/&/g')
|
||||
clipDuration=$( ffprobe -v error -show_format "$line" | awk -F= '/duration/{ print $2 }' )
|
||||
|
||||
printf '\t\t<video src="%s" clipBegin="%ss" dur="%ss" in="%ss" out="%ss"/>\n' "$clipPath" "$listStart" "$clipDuration" "0.0" "$clipDuration" >> "$trunk/$playlist"
|
||||
printf '\t<video src="%s" begin="%s" dur="%s" in="%s" out="%s"/>\n' "$clipPath" "$listStart" "$clipDuration" "0.0" "$clipDuration" >> "$trunk/$playlist"
|
||||
|
||||
# add start time
|
||||
listStart="$( awk -v lS="$listStart" -v cD="$clipDuration" 'BEGIN{ print lS + cD }' )"
|
||||
|
||||
done < <( find "$src" -name "*.mp4" )
|
||||
|
||||
printf "\t</body>\n</smil>\n" >> "$trunk/$playlist"
|
||||
printf "\t</body>\n</playlist>\n" >> "$trunk/$playlist"
|
||||
|
Loading…
Reference in New Issue
Block a user