O que isso aqui faz? #!/bin/bash #clear #echo -e…
- User
O que isso aqui faz?
#!/bin/bash #clear #echo -e '\033[01;32mABCDEFGHIJKLMNOPQRS\033[00;0m' echo -e '\033[01;32m—— KWAICUTTER v3 ——\033[00;0m' echo -e "\033[01;32m———————————————————\033[00;0m" folder=(ls -t "(ls -t "folder" | grep '.png' | head -1) #echo -e "\033[01;32mRECURSOS DETECTADOS\033[00;0m echo "" > tl echo -e "\033[01;32mVídeo:\033[00;0m tl echo -e "\033[01;32mFundo:\033[00;0m tl now=now >> tl outputfile="corte_now.mp4" if [[ "start" >> end" >> (ffmpeg -i "undefined(echo line1 | sed "s/'/\'\\\\\\\\\\\\''/g") line2=(echo line2 | sed "s/'/\'\\\\\\\\\\\\''/g") line3=(echo line3 | sed "s/'/\'\\\\\\\\\\\\''/g") line4=(echo line4 | sed "s/'/\'\\\\\\\\\\\\''/g") while true; do echo -e "\033[01;32m———————————————————\033[00;0m" echo -e -n "\033[01;33mRenderizar? (s/n) \033[00;0m" ; read answer if [ "answer" == "s" ]; then break elif [ "start" -to "video" -i "line1': fontfile='SourceSansPro-Black.otf': fontsize=60: fontcolor=white: x=(w-text_w)/2: y=185,
drawtext=text='line3': fontfile='SourceSansPro-Black.otf': fontsize=60: fontcolor=white: x=(w-text_w)/2: y=965,
drawtext=text='folder/cortes/$outputfile" -y - Assistant
Aparentemente este é um script em Bash que funciona como um cortador de vídeo chamado "Kwaicutter". Ele permite que o usuário selecione um vídeo e uma imagem para fundo e, em seguida, corte uma parte específica do vídeo. Também permite que o usuário adicione um título e um subtítulo ao vídeo resultante. O script usa o FFMPEG para realizar todas essas tarefas de edição de vídeo.
- User
Tem alguma forma de deixar o texto mais legível? Pode utilizar a scripting language de sua escolha, contanto que melhore a legibilidade.
- Assistant
Claro, aqui está uma versão mais legível do mesmo script, usando a linguagem de scripting Python:
python#!/usr/bin/env python import os import subprocess from datetime import datetime # Limpa o terminal subprocess.call('clear', shell=True) # Exibe o nome do programa print('\033[01;32m—— KWAICUTTER v3 ——\033[00;0m') # Obtém a pasta atual e os arquivos de vídeo e imagem folder = os.getcwd() video = max([f for f in os.listdir(folder) if f.endswith('.mp4')], key=os.path.getctime) image = max([f for f in os.listdir(folder) if f.endswith('.png')], key=os.path.getctime) # Exibe os arquivos detectados print(f"\033[01;32mVídeo:\033[00;0m {video}") print(f"\033[01;32mFundo:\033[00;0m {image}") # Cria um arquivo de log tl = open('temp_log.txt', 'w') tl.write('\n'.join([f'começo: {start}', f'the end: {end}', f'Título: {line1}', f'Subtítulo: {line3}']) + '\n') # Obtém o tempo de início e duração do vídeo if '-c' in sys.argv: start = input("\033[01;32mInício [Ex 00:00:10]: \033[00;0m") end = input("\033[01;32mFinal [Ex 00:01:30]: \033[00;0m") else: result = subprocess.run(['ffmpeg', '-i', video], stdout=subprocess.PIPE, stderr=subprocess.STDOUT) duration = [x for x in result.stdout.decode('utf-8').split('\n') if 'Duration' in x][0] end = duration.split()[1].replace(',', '') start = '00:00:00' # Exibe o título e subtítulo do vídeo print("\033[01;32mTítulo:\033[00;0m") line1 = input().replace("'", r"'\''") line2 = input().replace("'", r"'\''") print("\033[01;32mSubtítulo:\033[00;0m") line3 = input().replace("'", r"'\''") line4 = input().replace("'", r"'\''") # Renderiza o vídeo while True: answer = input("\033[01;33mRenderizar? (s/n) \033[00;0m") if answer == 's': break elif answer == 'n': exit() else: print("\033[01;31mApenas 's' ou 'n'\033[00;0m") # Cria a pasta "cortes" se ela não existir if not os.path.exists('cortes'): os.mkdir('cortes') # Define o nome do arquivo de saída now = datetime.now().strftime("%d-%m-%Y_%H-%M-%S") outputfile = f'corte_{now}.mp4' # Executa o comando do FFMPEG para cortar o vídeo e adicionar o título e subtítulo subprocess.call(f"ffmpeg -ss {start} -to {end} -avoid_negative_ts make_zero -i {video} -i {image} -filter_complex '[0]scale=-1:540.5[vid]; [1]
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.
Identical first prompt
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →
- Human-written demonstration (OpenAssistant volunteers)Compare side by side →