Issues with adding the current timestamp of a video when using FFPLAY - batch-file

Hi i am trying to add to display the current time of the video as an overlay. i have tried to do follow the answer of this previous post: https://superuser.com/questions/968685/how-to-display-current-time-with-the-ffplay-exe but with no luck.
This is my line of code:
"./ffmpeg-2023-01-25-git-2c3107c3e9-full_build/bin/ffplay.exe" -vf "drawtext=fontfile=./consola.ttf:text='%{pts:hms}':fontsize=48:fontcolor=white:box=1:boxborderw=6:boxcolor=black#0.75:x=(w-text_w)/2:y=h-text_h-20" -i "%shadowplays_folder%\%NEWEST_FOLDER%\%NEWEST_FILE%" -autoexit -x "1000" -alwaysontop
This will display the text "hms}" not the time.
the above code works fine if i replace it with a simple string:
"./ffmpeg-2023-01-25-git-2c3107c3e9-full_build/bin/ffplay.exe" -vf "drawtext=fontfile=./consola.ttf:text='test':fontsize=48:fontcolor=white:box=1:boxborderw=6:boxcolor=black#0.75:x=(w-text_w)/2:y=h-text_h-20" -i "%shadowplays_folder%\%NEWEST_FOLDER%\%NEWEST_FILE%" -autoexit -x "1000" -alwaysontop
This will display the text "test"
what am i missing?

Try '%%{pts:hms}' in place of '%{pts:hms}'
% needs to be escaped by another % to be interpreted literally.

Related

Awk and double quoting

I need some help with awk and double quoting.
I have this text file with separated by tab values (multiple lines).
Ex.
22-03-2016 11:25 25 Session reconnection succeeded user 10.10.10.10
Now I want to change the date notation.
I want above example to be
2016-03-22 11:25 (as in %Y-%m-%d %H:%M)
I am trying to use awk (on my mac)
I manually can change the date with:
date -j -u -f "%d-%m-%Y %H:%M" "22-03-2016 11:25" "+%Y-%m-%d %H:%M"
result: 2016-03-22 11:25
I am struggling with awk to do this. Having problems with the quoting.
Any other ways of doing this are appreciated!
Regards,
Ronald
Ok,
So I found a solution using sed.. (had to switch to a real linux enviroment.. but ok)
Using this command:
sed -i.bak -r 's/([0-9]{2})-([0-9]{2})-([0-9]{4})/\3-\2-\1/g' TextFile
Always funny how I find the answer right after I post a question....

How to convert multiple documents using the Document Conversion service ina script bash?

How can I convert more than one document using the Document Conversion service.
I have between 50-100 MS Word and PDF documents that I want to convert using the convert_document API method?
For example, can you supply multiple .pdf or *.doc files like this?:
curl -u "username":"password" -X POST
-F "config={\"conversion_target\":\"ANSWER_UNITS\"};type=application/json"
-F "file=#\*.doc;type=application/msword"
"https://gateway.watsonplatform.net/document-conversion-experimental/api/v1/convert_document"
That gives an error unfortunately: curl: (26) couldn't open file "*.doc".
I have also tried "file=#file1.doc,file2.doc,file3.doc" but that gives errors as well.
The service only accept one file at a time, but you can call it multiple time.
#!/bin/bash
USERNAME="<service-username>"
PASSWORD="<service-password>"
URL="https://gateway.watsonplatform.net/document-conversion-experimental/api/v1/convert_document"
DIRECTORY="/path/to/documents"
for doc in *.doc
do
echo "Converting - $doc"
curl -u "$USERNAME:$PASSWORD" \
-F 'config={"conversion_target":"ANSWER_UNITS"};type=application/json' \
-F "file=#$doc;type=application/pdf" "$URL"
done
Document Conversion documentation and API Reference.

How to get time conversion using FFmpeg

I have tried extracting video.mpg to images using FFmpeg command line and it works fine, but I want get time of the conversion process that will be taken till video.mpg is extracted, and save to Time.txt.
This is what I have tried so far:
ffmpeg -i video.mpg image%d.jpg>>time.txt
Where I have been wrong?
ffmpeg outputs the progress messages to stderr, so to redirect it to a file use 2>>time.txt:
ffmpeg -i video.mpg image%d.jpg 2>>time.txt
More info: http://ss64.com/nt/syntax-redirection.html
P.S. in batch-files % should be doubled: ffmpeg -i video.mpg image%%d.jpg 2>>time.txt

Bash array as argument inside of screen

The below code is is not working as I expect it to. I might be because I am doing this all wrong but I think it may be a quoting issue.
#!/bin/bash
IFS=$'\n'
fortune_lines=($(fortune | fold -w 30))
Screen_Session=$(mainscreen)
Screen_OneLiner=$(screen -p 0 -S ${Screen_Session} -X stuff "`printf "say ${fortune_lines[#]}\r"`")
for var in "${Screen_OneLiner[#]}"
do
echo "${var}"
done
I think I am not quoting something correctly because when I attempt to execute this. I get..
line 5: mainscreen: command not found
[screen is terminating
Essentially I am attempting to add this function (that works)
IFS=$'\n'
fortune_lines=($(fortune | fold -w 30))
To this screen one liner
screen -p 0 -S ${Screen_Session} -X stuff "`printf "say ${fortune_lines[#]}\r"`"
Then have it loop the array
for var in "${ArrayName[#]}"
do
echo "${var}"
done
So I am not sure how far I am away (in code) to what I am trying to do. Any help would be great.
Since feature requests to mark a comment as an answer remain declined, I copy the above solution here.
I managed to get this to work... gist.github.com/4006586 – user1787331
This line is problematic
Screen_Session=$(mainscreen)
You are using command substitution here, so if mainscreen is not a valid command, you'll get command not found error.
Maybe you mean to use braces instead of parentheses?

Concatenation of files using ffmpeg does not work as I expected. Why?

I execute the following command line
ffmpeg.exe
-i C:\Beema\video-source\DO_U_BEEMA176x144short.avi
-i C:\Beema\video-source\DO_U_BEEMA176x144short.avi
-i C:\Beema\temp\9016730-51056331-stitcheds.avi
-i C:\Beema\video-source\GOTTA_BEEMA176x144short.avi
-y -ac 1 -r 24 -b 25K
C:\Beema\video-out\9a062fb6-d448-48fe-b006-a85d51adf8a1.mpg
The output file in video-out ends up having a single copy of DO_U_BEEMA. I do not understand why ffmpeg is not concatenating.
Any help is dramatically appreciated,
mencoder -oac copy -ovc copy file1 file2 file3 … -o final_movie.mpg
Have you tried with mencoder?
Also are all of the files the same bitrate and dimensions? If not your going to need to make sure all of the video files are identical in these two areas before attempting to combine. It also appears your attempting to combine .avi's with a single .mpg, you'll most likely want to convert the .mpg to a similar format when re-encoding.
Hope this helps.
If it has C:\, it's Windows. use:
copy video1 + video2 + video3
and add more + videoN instances until you get there.
Here is the command that will work for you first cat the files then pipe to ffmpeg
cat C:\Beema\video-source\DO_U_BEEMA176x144short.avi C:\Beema\video-source\DO_U_BEEMA176x144short.avi C:\Beema\temp\9016730-51056331-stitcheds.avi
C:\Beema\video-source\GOTTA_BEEMA176x144short.avi | ffmpeg -f mpeg -i - C:\Beema\video-out\9a062fb6-d448-48fe-b006-a85d51adf8a1.mpg
-i - is important "-" this is the piped input to ffmpeg
Cheers.
I guess ffmpeg cann't do that. It usually takes only one input file. Trying to cat files to input may result in a lump togather, but i guess it won't stitch properly.
Best bet is mencoder or using transcode

Resources