
Recherche avancée
Autres articles (26)
-
La sauvegarde automatique de canaux SPIP
1er avril 2010, parDans le cadre de la mise en place d’une plateforme ouverte, il est important pour les hébergeurs de pouvoir disposer de sauvegardes assez régulières pour parer à tout problème éventuel.
Pour réaliser cette tâche on se base sur deux plugins SPIP : Saveauto qui permet une sauvegarde régulière de la base de donnée sous la forme d’un dump mysql (utilisable dans phpmyadmin) mes_fichiers_2 qui permet de réaliser une archive au format zip des données importantes du site (les documents, les éléments (...) -
Script d’installation automatique de MediaSPIP
25 avril 2011, parAfin de palier aux difficultés d’installation dues principalement aux dépendances logicielles coté serveur, un script d’installation "tout en un" en bash a été créé afin de faciliter cette étape sur un serveur doté d’une distribution Linux compatible.
Vous devez bénéficier d’un accès SSH à votre serveur et d’un compte "root" afin de l’utiliser, ce qui permettra d’installer les dépendances. Contactez votre hébergeur si vous ne disposez pas de cela.
La documentation de l’utilisation du script d’installation (...) -
Automated installation script of MediaSPIP
25 avril 2011, parTo overcome the difficulties mainly due to the installation of server side software dependencies, an "all-in-one" installation script written in bash was created to facilitate this step on a server with a compatible Linux distribution.
You must have access to your server via SSH and a root account to use it, which will install the dependencies. Contact your provider if you do not have that.
The documentation of the use of this installation script is available here.
The code of this (...)
Sur d’autres sites (4238)
-
mpv player with SFTP does not work in bash script [closed]
19 mars 2024, par Pickles888I am making a bash script to make it easier to stream from my media server at home.


In the bash script, it asks whether you want to list or search, and then uses mpv to stream the file. For some reason it says the file does not exist. When I try this in the terminal it works, but running the script gives this error :


[ffmpeg] libssh: Error opening sftp file: SFTP server: No such file
Failed to open sftp://[username:password]@[ip.of.server]/[directory/to/file]



My script :


#!/bin/bash

pass="[password]"

if [ $(nmcli | grep -c [home-network]) -gt 0 ]; then
 ip="[private.ip]"
else
 ip="[public.ip]"
fi

mfolder="[/directory/of/file]"

function select_option {

 # little helpers for terminal print control and key input
 ESC=$( printf "\033")
 cursor_blink_on() { printf "$ESC[?25h"; }
 cursor_blink_off() { printf "$ESC[?25l"; }
 cursor_to() { printf "$ESC[$1;${2:-1}H"; }
 print_option() { printf " $1 "; }
 print_selected() { printf " $ESC[7m $1 $ESC[27m"; }
 get_cursor_row() { IFS=';' read -sdR -p $'\E[6n' ROW COL; echo ${ROW#*[}; }
 key_input() { read -s -n3 key 2>/dev/null >&2
 if [[ $key = $ESC[A ]]; then echo up; fi
 if [[ $key = $ESC[B ]]; then echo down; fi
 if [[ $key = "" ]]; then echo enter; fi; }

 # initially print empty new lines (scroll down if at bottom of screen)
 for opt; do printf "\n"; done

 # determine current screen position for overwriting the options
 local lastrow=`get_cursor_row`
 local startrow=$(($lastrow - $#))

 # ensure cursor and input echoing back on upon a ctrl+c during read -s
 trap "cursor_blink_on; stty echo; printf '\n'; exit" 2
 cursor_blink_off

 local selected=0
 while true; do
 # print options by overwriting the last lines
 local idx=0
 for opt; do
 cursor_to $(($startrow + $idx))
 if [ $idx -eq $selected ]; then
 print_selected "$opt"
 else
 print_option "$opt"
 fi
 ((idx++))
 done

 # user key control
 case `key_input` in
 enter) break;;
 up) ((selected--));
 if [ $selected -lt 0 ]; then selected=$(($# - 1)); fi;;
 down) ((selected++));
 if [ $selected -ge $# ]; then selected=0; fi;;
 esac
 done

 # cursor position back to normal
 cursor_to $lastrow
 printf "\n"
 cursor_blink_on

 return $selected
}

stream() {
 mpv --fs "sftp://[username]:$pass@$ip$mfolder${options[choice]}"
}

search() {
 read -p "Search
> " search
 chars=$(echo -n "$search" | wc -c)
 printf '\n'
 clear
 printf "Search Results For $search:"
 printf '\n'
 readarray options < <(sshpass -p "$pass" ssh "[username]@$ip" ls "$mfolder" | agrep -i -$(($chars/3)) "$search")
 select_option "${options[@]}"
 choice=$?
 stream
}

list() {
 clear
 sshpass -p "$pass" ssh [username]@$ip ls "$mfolder"
 search
}

cmd() {
 read -p "List or Search 
(S/l)> " cmd
 printf '\n'
 
 if [[ "$cmd" == "S" || "$cmd" == "s" ]]; then
 search
 elif [[ "$cmd" == "L" || "$cmd" == "l" ]]; then
 list
 else
 search
 fi
}

main() {
 cmd
}

main



Anything put in brackets is to not share my personal info (except for arrays, if statements etc)


Also this seems to have only changed while I was making the script. In the beginning, it was working great, but at one point it randomly stopped working.


I have a feeling its some kind of quote mess up or something stupid like that. I have tried to edit it and fix it to the best of my abilities but nothing I did fixed it.


I also think it could have to do with it being run in the bash environment as I normally use zsh. However I tested it in my shell by running /bin/bash and executing the command and it worked.


Also the option chooser was not made by me.


-
avformat/rtsp : extend the PATH buffer to 2048
7 août 2024, par Stefano Mandelliavformat/rtsp : extend the PATH buffer to 2048
Recently, I have been experiencing an increasing number of user that use ffmpeg
to retrive RTSP stream from personal mediaproxies (e.g. MediaMtx) with
authorization based on JWT. The current length of PATH does not permit to
insert the token in the URL failing the authorization with no possibilities to
get the video.VLC has just modified the RSTP max URL length, and it permits to use token
inside the URL.For these reasons, I propose this patch to extend the PATH buffer from 1024 to
2048 in order to use tokens and the authorization process based on JWT.Signed-off-by : Marton Balint <cus@passwd.hu>
-
FFmpeg Streaming Video SpringBoot endpoint not show video duration in video players
7 avril 2024, par lxluxo23it turns out that I've been working on a personal project just out of curiosity.
the main function is to stream video by first encoding it through ffmpeg
then playback said video from any other device
call it "plex" very very primitive


although I achieve my goal which is to encode and send the video to the devices that make the request
this video is sent so to speak as a live broadcast.
I can only pause it, no forward or rewind, anyone have any idea what I am doing wrong or if I should take some other approach either in my service or controller ?


I leave fragments of my code


THE CONTROLLER


@RestController
@RequestMapping("/api")
@Log4j2
public class StreamController {

 @Autowired
 VideoStreamingService videoStreamingService;

 @Autowired
 VideoService videoService;


 @GetMapping("/stream/{videoId}")
 public ResponseEntity<streamingresponsebody> livestream(@PathVariable Long videoId,@RequestParam(required = false) String codec) {
 Video video = videoService.findVideoById(videoId);
 if (video != null) {
 Codec codecEnum = Codec.fromString(codec);
 return ResponseEntity.ok()
 .contentType(MediaType.valueOf("video/mp4"))
 .body(outputStream -> videoStreamingService.streamVideo(video.getPath(), outputStream,codecEnum));
 }
 return ResponseEntity.notFound().build();
 }
}
</streamingresponsebody>


THE SERVICE


@Service
public class VideoStreamingService {

 public void streamVideo(String videoPath, OutputStream outputStream, Codec codec) {

 FFmpeg ffmpeg = FFmpeg.atPath()
 .addArguments("-i", videoPath)
 .addArguments("-b:v", "5000k")
 .addArguments("-maxrate", "5000k")
 .addArguments("-bufsize", "10000k")
 .addArguments("-c:a", "aac")
 .addArguments("-b:a", "320k")
 .addArguments("-movflags", "frag_keyframe+empty_moov+faststart")
 .addOutput(PipeOutput.pumpTo(outputStream)
 .setFormat("mp4"))
 .addArgument("-nostdin");
 if (codec == Codec.AMD) {
 ffmpeg.addArguments("-profile:v", "high");
 }
 ffmpeg.addArguments("-c:v", codec.getFfmpegArgument());
 ffmpeg.execute();
 }
}



I have some enums to vary the encoding and use hardware acceleration or not.


and here is an example from my player
the endpoint is the following


http://localhost:8080/api/stream/2?codec=AMD

screenshot

I'm not sure if there's someone with more knowledge in either FFmpeg or Spring who could help me with this minor issue, I would greatly appreciate it. I've included the URL of the repository in case anyone would like to review it when answering my question




I tried changing the encoding format.
I tried copying the metadata from the original video.
I tried sending a custom header.
None of this has worked.


I would like to achieve what is mentioned in many sites, which is when you load a video from the network, the player shows how much of that video you have in the local "buffer".