-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SCTE-35 Preroll #26
Comments
I deleted them. I thought it was kind of rude of me to post my stuff on his repo. https://github.com/futzu/threefive/blob/master/examples/stream/preroll.py |
Never used pip on my mac, only homebrew. This will take me some time to figure out. |
The
I'd suggest adding the following python shebang
Then you can do # install latest stable python3 release
brew install python@3.9
# if you get a link warning
brew link python@3.9 --force
# finally
python3.9 -m pip install <whatever PyPi pkg you need>
chmod +x preroll.py
python3 preroll.py |
I was going to ask Vlad how to do it :)) |
I have no idea what I'm doing but clearly I should not be trying to install the linked python script using pip. This stuff is insanely hard for the uninitiated. I tried to install pypy3 so I went to https://www.pypy.org/download.html#. First you have to figure out that PyPy3.7 is probably PyPy3 despite being under the heading "PyPy v7.3.4" so I'm already not confident that I'm in the right spot. Downloading PyPy3.7 for macOS puts a tarball in my Downloads folder. In what way is that a download and install per the page heading "Download and Install"? Edit: a little Google searching revealed that pypy3 can be installed with brew so I'm doing that now. Why don't they say that on the pypy 'install' webpage? Edit2: pypy3 installed:
Now I think I need to clone the threefive git? |
I cloned the threefive git and 'make install' worked but 'make pypy3' doesn't:
|
Pip is the way to go Do this as root.
https://github.com/futzu/threefive#install I don't mean to discourage your efforts, |
i deleted my cloned git and ran
Indeed I'm not comfortable with python or macOS command line at all but the Venn diagram intersection between broadcast engineers who know something about SCTE-35 and software engineers who know something about python and command line must be incredibly small. |
You don't need to know where it's installed actually :)
|
no, I deleted the git clone and installed via pip with |
Did you get it running? just download preroll.py , I use curl. curl https://raw.githubusercontent.com/futzu/threefive/master/examples/stream/preroll.py -o preroll.py
pypy3 preroll.py myvideo.ts
next file: myvideo.ts
Program: 1050 Splice Insert @ 21940.656778 Splice Time: 21951.133267 Preroll: 10.476489
Program: 1050 Splice Insert @ 21942.672778 Splice Time: 21951.133267 Preroll: 8.460489
Program: 1050 Splice Insert @ 21944.688778 Splice Time: 21951.133267 Preroll: 6.444489
Program: 1010 Splice Insert @ 22508.436511 Splice Time: 22516.907656 Preroll: 8.471145
Program: 1010 Splice Insert @ 22510.452511 Splice Time: 22516.907656 Preroll: 6.455145
Program: 1050 Splice Insert @ 22015.680778 Splice Time: 22026.133267 Preroll: 10.452489
Program: 1050 Splice Insert @ 22017.696778 Splice Time: 22026.133267 Preroll: 8.436489
Program: 1050 Splice Insert @ 22019.712778 Splice Time: 22026.133267 Preroll: 6.420489
Program: 1040 Splice Insert @ 22857.8786 Splice Time: 22864.350067 Preroll: 6.471467
Program: 1040 Splice Insert @ 22863.9266 Splice Time: 22870.350067 Preroll: 6.423467
Program: 1010 Splice Insert @ 22688.436511 Splice Time: 22696.907656 Preroll: 8.471145
Program: 1010 Splice Insert @ 22690.452511 Splice Time: 22696.907656 Preroll: 6.455145
Program: 1040 Splice Insert @ 22953.9266 Splice Time: 22960.350067 Preroll: 6.423467
Program: 1010 Splice Insert @ 23508.372511 Splice Time: 23516.827656 Preroll: 8.455145
Program: 1010 Splice Insert @ 23510.388511 Splice Time: 23516.827656 Preroll: 6.439145
Program: 1010 Splice Insert @ 23688.372511 Splice Time: 23696.827656 Preroll: 8.455145
Program: 1010 Splice Insert @ 23690.388511 Splice Time: 23696.827656 Preroll: 6.439145
Program: 1030 Splice Insert @ 23676.9783 Splice Time: 23683.480033 Preroll: 6.501733 |
#!/usr/bin/env bash
echo "--- Checking for Python 3"
if command -V python3; then
echo "--- Python 3 is available"
else
echo "--- Install Python 3!"
fi
echo "--- Installing threefive"
python3 -m pip install --user threefive
echo "--- Downloading pre-roll.py"
curl \
--url https://raw.githubusercontent.com/futzu/threefive/master/examples/stream/preroll.py \
--output preroll.py
echo "--- Adding Python3 shebang"
sed -i '1s/^/#!/usr/bin/env python3\n/' pre-roll.py
chmod +x get-deps.sh
./get-deps.sh
python3 preroll.py VIDEO_FILE.ts |
Ok, the curl command snagged preroll.py and I was able to run it. Results are a bit different than what I'm looking for and more along the lines of tsduck (maybe due to the same limitations of processing in realtime rather than with the multi-pass benefit of offline?):
DVB Inspector and Sencore Compressed Stream Analyzer: |
You don't need to mess with site packages. It is imported in the pre-roll.py file and Python will take care of all that behind the scenes. If it is already installed then you can just move on to the next step of the process I outlined. The only thing that I see that needs to be added to Add the following line to the first line of the #!/usr/bin/env python3 |
thank you @vladdoster, both commands do work indeed:
|
Happy to help 😃 . |
That's the beauty of threefive, it can include whatever you like. |
Here's one that matches DVB inspector's output. https://github.com/futzu/threefive/blob/master/examples/stream/preroll2.py pypy3 preroll2.py plp0.ts
21951.133267(preroll time = 10.476489)
21951.133267(preroll time = 8.460489)
21951.133267(preroll time = 6.444489)
22516.907656(preroll time = 8.471145)
22516.907656(preroll time = 6.455145)
22026.133267(preroll time = 10.452489)
22026.133267(preroll time = 8.436489)
22026.133267(preroll time = 6.420489)
22864.350067(preroll time = 6.471467)
22870.350067(preroll time = 6.423467)
22696.907656(preroll time = 8.471145)
22696.907656(preroll time = 6.455145)
22960.350067(preroll time = 6.423467)
23516.827656(preroll time = 8.455145)
23516.827656(preroll time = 6.439145)
23696.827656(preroll time = 8.455145)
23696.827656(preroll time = 6.439145)
23683.480033(preroll time = 6.501733) |
vlad , try sed -i '1i\#\!/usr/bin/env python3\n\n' preroll.py
|
I'm referring to the values, not the formatting. The whole thread I started on tsduck was about the values computed for preroll. The gold standard is the offline processing by Sencore Compressed Media analyzer (CMA). The author of DVB Inspector added preroll at my request and his computation agrees with Sencore CMA. Author of tsduck added splicemonitor plugin at my request but the computed results for preroll differ from Sencore CMA. Your results also differ. Here's the original thread on tsduck and here's the original thread on DVB Inspector. In these threads are examples and screenshots of the different values computed for preroll by the different tools. |
How much do they differ? Using PCR will be different because PCR is 33 bit + 9 bit extension SCTE-35 specifies time in PTS, so I use PTS not PCR. |
I cited an example: SCTE-35 specifies time using PTS indeed, however, there is no PTS associated with the actual SCTE-35 command packets--they free run on their own with no associated PTS. |
I see your point. Let me try using PCR and see what I get. |
Run this and see what what you get.
|
so that's much closer to the gold standard results: I can definitely work with that. How robust is this new calculation? Are you counting packets from last PTS to the SCTE-35 command packet and using bitrate to calculate the time to the SCTE-35 command packet? That's what the others do. |
This is just a quick hack to see if I can do it. preroll = (SCTE-35.command.pts_time) - (closest PCR time to the SCTE-35 packet) If you think about it though, I bet a lot of people use PCR , Which is the proper method is not really clear. |
You can extrapolate the PTS. Start with closest PTS then add the time it takes for the number of packets between last PTS and the SCTE-35 packet. The time is the (# of packets X bits/packet) / bitrate. |
First of all, I started using pypy3--it is WAY faster as you noted... somewhere... :-) I still think if you could add |
Thank you for trying pypy3, Firstly, you're assuming they are doing it correctly. The PCR Preroll is ~0.02 higher on the first Splice time 0.021292000000000755 0.0020999999999995467 I've been working in broadcasting for some time, |
We are doing frame accurate splicing. In conjunction with the encoder providing an I-Frame at the exact PTS time, we do frame-accurate SCTE-35 splicing out and back in to the live stream: Edgecaster Pro frame-accurate ad insertion news and Edgecaster Pro product Notwithstanding that, I agree that I do not need any more accuracy on the preroll calculation. As you say, the SCTE standard requires simply a minimum of 4 seconds for preroll timing. Believe you me... it took me months to get a customer to get this right which is what precipitated my need for a free tool to analyze the preroll timing. Thanks for your efforts! |
You're very welcome. Give me a day or two, and I'll have a new release with the PCR and PTS baked in. |
One idea I had was to I'll keep thinking about it. |
Ultimately the tool, as you have it now, really meets the fundamental purposes of preroll analysis. Thanks again. |
Could I get a copy of your test video, I have servers you can upload it to if needed. |
sure, for your personal use only. not sure how to DM server credentials... |
I'm calculating pre-roll as the difference between when a SCTE-35 packet is seen and the splice PTS time. I think pre-roll is more better defined as the difference between the PCR of the SCTE-35 packet and the PCR of the actual splice point, not the Splice Insert PTS specified in the Cue message. As you mentioned earlier, The real-time calculation is more a function of the rules imposed by the splicer.
6.1.4.2 Frame Accuracy Frame accuracy describes whether the transition between sequences occurs at exactly the frame specified. Assuming that a given splicer can be commanded to splice at an exact frame, the issue is whether the splicer can perform the splice at exactly the For example, almost any splicer can be frame accurate when commanded to splice at pre-conditioned Splice Points, whereas only splicers that can produce I-frames on demand can be frame accurate when commanded to splice in a situation where neither the in-point or out-point are anchor frames. Other splicers can be frame accurate when commanded to splice where the out-point is an anchor frame and the in-point is an I-frame. Unfortunately, there are different views among the manufacturers regarding what constitutes “frame accurate”. Therefore it is important to articulate what the range of possible circumstances is and how the Splice Point might be adjusted in these circumstances.** |
try it this way. #!/bin/sh
target=python3
url="https://raw.githubusercontent.com/futzu/threefive/master/examples/stream/preroll.py"
filename=$(basename "$url")
py3="which ${target}"
if $py3;then
printf "Installing threefive\n"
`${py3}` -m pip install --upgrade threefive
# add shebang
printf "#!`${py3}`\n\n" > $filename
printf " Downloading $filename\n"
curl -s --url $url >> $filename
printf " making $filename executable"
chmod +x $filename
else
printf "\ntarget ${target} not found\n"
fi
|
Now I can't stop thinking about it........ I am reopening this. |
Testing threefive with ffmpeg.
SCTE-35 Packetffmpeg
threefive
SCTE-35 Splice Insertffmpeg
### threefive
|
I believe I have it accurate now.ffmpeg
threefive
|
Here's the commit. |
https://github.com/futzu/threefive/releases/tag/v.2.2.89
|
You really have to know python to use threefive. |
OK, I made it abundantly clear at the beginning that I do not know python. In any event, I ran the script you posted above:
that seems to have (re)upgraded threefive and grabbed the example script Is there a typo in @vladdoster's original script?
where the last line should be |
lol, good catch. I didn't escape the forward slashes. Try this: #!/usr/bin/env bash
echo "--- Checking for Python 3"
if command -V python3; then
echo "--- Python 3 is available"
else
echo "--- Install Python 3!"
fi
echo "--- Installing threefive"
python3 -m pip install --user threefive
echo "--- Downloading pre-roll.py"
curl \
--url https://raw.githubusercontent.com/futzu/threefive/master/examples/stream/preroll.py \
--output pre-roll.py
echo "--- Adding Python3 shebang"
sed -i '1s/^/#!\/usr\/bin\/env python3\n/' pre-roll.py
echo "--- Adding executable bit to pre-roll.py"
chmod +x pre-roll.py |
Nice. NOW I know python :-) of course I'm kidding: I know there's a lot more to threefive that can be done by creating comprehensive python scripts and importing threefive as a library. It's just not where I am. I need simple tools to measure preroll and I have a plethora now including the sample script preroll.py so thanks! |
Check https://github.com/futzu/scte35 in a couple weeks. |
@BartmanEH ,
Here's a Splice Insert with a DTMF Descriptor.
|
I did not know that but then, our solution is purely digital working with SCTE-104/35 Splice In commands only. |
I think your side of the conversation in the tsduck thread was deleted. Let's pick it up here.
It will take me some time to get up to speed on installing and using threefive. In the meantime, where do I grab the latest version that you added preroll to?
edit: I see it, it's the 'master' code thread (terrible name, github... come on)
The text was updated successfully, but these errors were encountered: