Reputation: 312
I've tried to create a script that saves a stream to an mp4 using h264. The part after the --sout was extracted from the GUI in the Stream wizard.
My problem is: The stream does not display or save, and it does not get variable i set as filename
#!/bin/bash
#date
#date +"%c"
#var=$(date)
#var=`date`
#now=$date
#echo "$now"
date +"%m_%d_%Y"
now=$(date +"%m_%d_%Y")
_now=$(date +"%T_%d_%m_%Y")
_file="vidlecture_$_now.mp4"
vlc -vvv tcp://1.1.1.1:3000 --sout="#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:duplicate{dst=file{dst=$file.mp4,no-overwrite},dst=display}:no-sout-all:sout-keep"
This is the error I get:
[9f30dbe0] main stream output error: stream chain failed for `transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:duplicate{dst=file{dst=.mp4,no-overwrite},dst=display}:no-sout-all:sout-keep'
[9f20f3f0] main input error: cannot start stream output instance, aborting
[01d3c6e0] main playlist debug: dead input
[01d3c6e0] main playlist debug: changing item without a request (current 0/1)
[01d3c6e0] main playlist debug: nothing to play
EDIT:
I updated my script and error here to reflect @Aaron's comment which helped me to fix the filename variable. Script:
#!/bin/bash
#date
#date +"%c"
#var=$(date)
#var=`date`
#now=$date
#echo "$now"
date +"%m_%d_%Y"
now=$(date +"%m_%d_%Y")
_now=$(date +"%T_%d_%m_%Y")
_file="vidlecture_$_now.mp4"
vlc -vvv tcp://1.1.1.1:3000 --sout="#transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:duplicate{dst=file{dst=$_file.mp4,no-overwrite},dst=display}:no-sout-all:sout-keep"
Error:
[9f30da80] main stream output debug: stream=`sout-keep'
[9f30dc80] main stream out debug: looking for sout stream module matching "sout-keep": 23 candidates
[9f30dc80] main stream out debug: no sout stream modules matched
[9f30dc80] main stream out debug: destroying chain... (name=(null))
[9f30dc80] main stream out debug: destroying chain done
[9f30da80] main stream output error: stream chain failed for `transcode{vcodec=h264,acodec=mpga,ab=128,channels=2,samplerate=44100,scodec=none}:duplicate{dst=file{dst=vidlecture_11:30:58_09_03_2020.mp4.mp4,no-overwrite},dst=display}:no-sout-all:sout-keep'
[9f20f390] main input error: cannot start stream output instance, aborting
Upvotes: 1
Views: 4860
Reputation: 1037
For me worked:
--sout "#std{access=file,mux=mp4,dst=output.mp4}"
or for both destinations (display and file)
--sout "#duplicate{dst=display,dst=std{access=file,mux=mp4,dst=output.mp4}}"
Upvotes: 1
Reputation: 1984
Sorry for jumping in, but not much results for those who encounter this issue as a programmer.
if you have this issue, the solution is to remove the prefix ":sout=..."
e.g.
instead of ":sout=#transcode{vcodec..."
this works: "#transcode{vcodec..."
Hope that helps any programmer out there..
Upvotes: 0