Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nulrdcscripts/tools/ffplaywindow/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ To run the script. From nul-rdc-scripts
```
poetry run ffplaywindow -i \path\to\input
```
To change the highlight color for the BRNG filter. Use -hi or --highlight followed by color name or hexcode.
To change the highlight color for the BRNG filter. Use -hi or --highlight followed by color name or hexcode. -- This only works on Windows for now. In order to change you will need to edit the code
```
poetry run ffplaywindow -i \path\to\input -hi 'color name or hexcode'
```
Expand Down
52 changes: 35 additions & 17 deletions nulrdcscripts/tools/ffplaywindow/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,34 +3,52 @@
from nulrdcscripts.tools.ffplaywindow.scriptparser import args


def main():
input_path = os.path.normpath(args.input_path)
ffplay_path = os.path.normpath(args.ffplay_path)
ostype = os.name
fontfile_windows = "/Windows/Fonts/arial.ttf"
fontfile_mac = ""

if ostype == "nt":
font = fontfile_windows
else:
font = fontfile_mac

ffplay_filter = (
"-vf split=5[a][b][c][d][e];[a]copy,drawtext=text='%{pts\:hms}':box=1:boxborderw=5:x=(w-text_w)/2:y=h-(text_h*2):fontsize=20:fontfile="
def declareFfplayfilter(font):
return (
"-vf split=5[a][b][c][d][e];[a]copy,drawtext=text='%{pts\\:hms}':box=1:boxborderw=5:x=(w-text_w)/2:y=h-(text_h*2):fontsize=20:fontfile="
+ font
+ "[a1];[b]field=top,format=yuv422p,waveform=scale=digital:intensity=0.1:mode=column:mirror=1:c=1:f=lowpass:e=instant:graticule=green:flags=numbers+dots[b1];[c]field=bottom,format=yuv422p,waveform=scale=digital:intensity=0.1:mode=column:mirror=1:c=1:f=lowpass:e=instant:graticule=green:flags=numbers+dots[c1];[d]format=yuv422p,vectorscope=i=0.04:mode=color2:c=1:envelope=instant:graticule=green:flags=name,scale=512:512,drawbox=w=9:h=9:t=1:x=128-3:y=512-452-5:[email protected],drawbox=w=9:h=9:t=1:x=160-3:y=512-404-5:[email protected],drawbox=w=9:h=9:t=1:x=192-3:y=512-354-5:[email protected],drawbox=w=9:h=9:t=1:x=224-3:y=512-304-5:[email protected],drawgrid=w=32:h=32:t=1:[email protected],drawgrid=w=256:h=256:t=1:[email protected][d1];[e]scale=512:ih,signalstats='out=brng:color="
+ args.highlight_color
+ "'"
+ "[e1];[a1][b1][c1][e1][d1]xstack=inputs=5:layout='0_0|0_h0|0_h0+h1|w0_0|w0_h0' -af channelmap='0|1:stereo'"
)
command = ffplay_path + " " + "-i" + " " + input_path + " " + ffplay_filter

# This command (above) is from VRecord's Visual filter. We do not own/nor did we come up with this.

def main():
input_path = os.path.normpath(args.input_path)
ffplay_path = os.path.normpath(args.ffplay_path)
ostype = os.name

if ostype == "nt":
font = "/Windows/Fonts/arial.ttf"
ffplayfilter = declareFfplayfilter(font)
command = ffplay_path + " " + "-i" + " " + input_path + " " + ffplayfilter
else:
font = "/Library/Fonts/Arial.ttf" # Specify a valid font path for macOS
ffplayfilter = declareFfplayfilter(font)
command = [
'ffplay', input_path,
'-vf', (
'split=5[a][b][c][d][e];'
'[a]copy,drawtext=text=\'%{pts\\:hms}\':box=1:boxborderw=5:x=(w-text_w)/2:y=h-(text_h*2):fontsize=20:fontfile=font[a1];'
'[b]field=top,format=yuv422p,waveform=scale=digital:intensity=0.1:mode=column:mirror=1:c=1:f=lowpass:e=instant:graticule=green:flags=numbers+dots[b1];'
'[c]field=bottom,format=yuv422p,waveform=scale=digital:intensity=0.1:mode=column:mirror=1:c=1:f=lowpass:e=instant:graticule=green:flags=numbers+dots[c1];'
'[d]format=yuv422p,vectorscope=i=0.04:mode=color2:c=1:envelope=instant:graticule=green:flags=name,scale=512:512,'
'drawbox=w=9:h=9:t=1:x=128-3:y=512-452-5:[email protected],drawbox=w=9:h=9:t=1:x=160-3:y=512-404-5:[email protected],'
'drawbox=w=9:h=9:t=1:x=192-3:y=512-354-5:[email protected],drawbox=w=9:h=9:t=1:x=224-3:y=512-304-5:[email protected],'
'drawgrid=w=32:h=32:t=1:[email protected],drawgrid=w=256:h=256:t=1:[email protected][d1];'
'[e]scale=512:ih,signalstats=out=brng:color=red[e1];'
'[a1][b1][c1][e1][d1]xstack=inputs=5:layout=0_0|0_h0|0_h0+h1|w0_0|w0_h0'
),
'-af', 'channelmap=0|1:stereo'
]

# Run the ffplay command
subprocess.run(command)

print(
"To exit the playback window, while in window use the 'esc' key. To fast-forward or rewind, use the respective arrow keys."
)
subprocess.run(command)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "nul-rdc-scripts"
version = "0.5.1"
version = "0.5.2"
description = "Scripts for NUL RDC Digitization Team"
authors = [
"Northwestern University Libraries <[email protected]>",
Expand Down