Quantcast
Channel: MediaSPIP
Viewing all 117670 articles
Browse latest View live

run command that got error thought python

$
0
0

Wassup.
I have shell command.

ffmpeg -list_devices true -f dshow -i dummy -hide_banner

When i run that command i get output data(see text bellow)

[dshow @ 00000281450fbdc0] DirectShow video devices (some may be both video and audio devices)
[dshow @ 00000281450fbdc0] "HD WebCam"
[dshow @ 00000281450fbdc0] Alternative name "@device_pnp_\\?\usb#vid_0408&pid_a060&mi_00#6&391c16c1&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global"
[dshow @ 00000281450fbdc0] DirectShow audio devices

[dshow @ 00000281450fbdc0] "Microphone (Realtek High Definition Audio)"
[dshow @ 00000281450fbdc0] Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{4727F33A-DE04-4706-8312-03696FACC791}"
[dshow @ 00000281450fbdc0] "Stereo mix (Realtek High Definition Audio)"
[dshow @ 00000281450fbdc0] Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{534A8FBC-6C02-4384-B51C-D0363BB7F8FD}"
[dshow @ 00000281450fbdc0] "Microphone (Avsoft Virtual Audio Device)"
[dshow @ 00000281450fbdc0] Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{5CE20B48-361E-4B96-B113-B3E02BA448EC}"
dummy: Immediate exit requested

I have to get list of all audio devices. And i don't want to parse that string, i will be hard. How can i get list of all audio devices using ffmpeg-python module? Thank u.

UPD: i have decided to parse that string. But when i type:

command = subprocess.check_output('ffmpeg -list_devices true -f dshow -i dummy -hide_banner', shell=True)

i get this error:

subprocess.CalledProcessError: Command 'ffmpeg -list_devices true -f dshow -i dummy -hide_banner' returned non-zero exit status 1.


How can i call that command and put its result into my variable "command"?


Evolution #4567: balise introduction

$
0
0

Pas certain que ça réponde à ta demande, mais as-tu connaissance des balises https://www.weblog.eliaz.fr/article72.html ?

Sinon, je ne comprends pas ces deux parties de ton ticket :

avec éventuellement le texte entre intro car ce filtre coupe correctement le texte sans laisser des raccourcis et autre element genant

Tu parles de la balise que je cite ?

ou pouvoir couper le texte sans que les raccourcis sur des paragraphes restent dans le texte couper

Qu'entends-tu par "les raccourcies sur les paragraphes" ?

run command that gets error thought python

$
0
0

Wassup.
I have shell command.

ffmpeg -list_devices true -f dshow -i dummy -hide_banner

When i run that command i get output data(see text bellow)

[dshow @ 00000281450fbdc0] DirectShow video devices (some may be both video and audio devices)
[dshow @ 00000281450fbdc0] "HD WebCam"
[dshow @ 00000281450fbdc0] Alternative name "@device_pnp_\\?\usb#vid_0408&pid_a060&mi_00#6&391c16c1&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\global"
[dshow @ 00000281450fbdc0] DirectShow audio devices

[dshow @ 00000281450fbdc0] "Microphone (Realtek High Definition Audio)"
[dshow @ 00000281450fbdc0] Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{4727F33A-DE04-4706-8312-03696FACC791}"
[dshow @ 00000281450fbdc0] "Stereo mix (Realtek High Definition Audio)"
[dshow @ 00000281450fbdc0] Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{534A8FBC-6C02-4384-B51C-D0363BB7F8FD}"
[dshow @ 00000281450fbdc0] "Microphone (Avsoft Virtual Audio Device)"
[dshow @ 00000281450fbdc0] Alternative name "@device_cm_{33D9A762-90C8-11D0-BD43-00A0C911CE86}\wave_{5CE20B48-361E-4B96-B113-B3E02BA448EC}"
dummy: Immediate exit requested

I have to get list of all audio devices. And i don't want to parse that string, i will be hard. How can i get list of all audio devices using ffmpeg-python module? Thank u.

UPD: i have decided to parse that string. But when i type:

command = subprocess.check_output('ffmpeg -list_devices true -f dshow -i dummy -hide_banner', shell=True)

i get this error:

subprocess.CalledProcessError: Command 'ffmpeg -list_devices true -f dshow -i dummy -hide_banner' returned non-zero exit status 1.


How can i call that command and put its result into my variable "command"?

Evolution #4567: balise introduction

$
0
0

je suis en spip.3.3 et j'observe que couper n'enleve pas toutes les racourcis... je pensais que c'etait normal et c'est pour cela que je voulais une balise equivalente a #INTRODUCTION

 

 

par exemple [| reste. J'ai remarque que cela concerné les raccourcis portant sur des paragraphes comme centrer un paragraphequi sont dans pre propre ou post propre d'un PLUGIN

 

 peut être s'agit t'il d'un bug de couper en 3.3 ?

 

 

exemple sur un site de test

http://test3.montpellier2.web-ecclesial.fr/spip.php?rubrique16

 

a gauche [(#TEXTE*|couper{1000, '...'})] et a droite #INTRODUCTION{1000}

 

 

sans le * c'est pire ...[(#TEXTE|couper{1000, '...'})]

 

 

 

 

 

 

 

Message du 03/10/20 18:05
De :
A :
Copie à :
Objet : [SPIP - Evolution #4567] balise introduction

La demande #4567a été mise à jour par RastaPopoulos ♥.
Mais qu'est-ce que tu appelles "les raccourcis portant sur les paragraphes", ça veut dire quoi ?

Le filtre |couper supprime toutes les balises HTML (ça appelle supprier_tags), absolument toutes ! Donc il ne reste déjà que du texte brut à la fin. Donc pourquoi une autre balise, que veux-tu de plus ou de moins ?

Evolution #4567: balise introduction

Auteur: josiane aletto
Statut: Nouveau
Priorité: Normal
Assignéà:
Catégorie:
Version cible: 3.4
Resolution:

avoir l'equivalent de la balise introduction par exemple balise introduction_texte qui va chercher l'introduction uniquement dans le texte avec éventuellement le texte entre intro car ce filtre coupe correctement le texte sans laisser des raccourcis et autre element genant
ou pouvoir couper le texte sans que les raccourcis sur des paragraphes restent dans le texte couper

Vous recevez ce mail car vous êtes impliqués sur ce projet.
Pour changer les préférences d'envoi de mail, allez sur http://core.spip.net/my/account

Evolution #4567: balise introduction

$
0
0

En fait la balise #INTRODUCTION,permet d'avoir une introduction automatique en nettoyant BIEN le texte même si la rédacteur n'utilise pas les balises intro.

mais cette balise prend le contenu du descriptif /chapo et si vide regarde si il ya intro et sinontravaille sur le texte

 

Cependant on eut utiliser par ailleurs la balise #DESCRIPTIF et dans ce cas on voudrais utiliser l'equivalent de #INTRODUCTION directement sur #TEXTE sans que cela reprenne le descriptif

 

pouvoir faire un truc du genre

 

[#GET{desc,n}|=={o}|oui )#INTRODUCTION{800}]

[#GET{desc ,n}|=={n}|oui )#INTRODUCTION_TEXTE{800}] en ne prenant pas en compte le descriptif/chapo

 

 

 

ou sinon un couper qui nettoit effectivement le texte

j'ai essayé

 

[#GET{intro,n}|=={n}|oui )[(#TEXTE|couper{1000, '...'}|textebrut)] et differente variantes mais les raccourcis portant sur des paragraphes restent alors que #INTRODUCTION donne un résultat ne comportant que du texte.

 

je ne sais pas si j'ai été plus claire

merci

 

 
 

 

 

 

 

 

Message du 03/10/20 13:53
De :
A :
Copie à :
Objet : [SPIP - Evolution #4567] balise introduction

La demande #4567a été mise à jour par b b.

Version cible mis à 3.4

Pas certain que ça réponde à ta demande, mais as-tu connaissance des balises https://www.weblog.eliaz.fr/article72.html ?

Sinon, je ne comprends pas ces deux parties de ton ticket :

avec éventuellement le texte entre intro car ce filtre coupe correctement le texte sans laisser des raccourcis et autre element genant

Tu parles de la balise que je cite ?

ou pouvoir couper le texte sans que les raccourcis sur des paragraphes restent dans le texte couper

Qu'entends-tu par "les raccourcies sur les paragraphes" ?

Evolution #4567: balise introduction

Auteur: josiane aletto
Statut: Nouveau
Priorité: Normal
Assignéà:
Catégorie:
Version cible: 3.4
Resolution:

avoir l'equivalent de la balise introduction par exemple balise introduction_texte qui va chercher l'introduction uniquement dans le texte avec éventuellement le texte entre intro car ce filtre coupe correctement le texte sans laisser des raccourcis et autre element genant
ou pouvoir couper le texte sans que les raccourcis sur des paragraphes restent dans le texte couper

Vous recevez ce mail car vous êtes impliqués sur ce projet.
Pour changer les préférences d'envoi de mail, allez sur http://core.spip.net/my/account

Evolution #4567: balise introduction

$
0
0

Mais qu'est-ce que tu appelles "les raccourcis portant sur les paragraphes", ça veut dire quoi ?

Le filtre |couper supprime toutes les balises HTML (ça appelle supprier_tags), absolument toutes ! Donc il ne reste déjà que du texte brut à la fin. Donc pourquoi une autre balise, que veux-tu de plus ou de moins ?

Live streaming Rmtp node-media-server real server not creating video files but wont fail (OBS)

$
0
0

I have made a live streaming server with node-media-server and it works well in local but when i put it on a real server (ubuntu, nginx) its just creating the folder but not creating video files and no errors given OBS the streaming sofware not failing. is it something to do with ffmpeg ? maybe needed packages didnt install or ? idk whats going on :D

Cofig of node-media-server:

rtmp_server: {
 rtmp: {
 port: 1935,
 chunk_size: 60000,
 gop_cache: false,
 ping: 60,
 ping_timeout: 30
 },
 http: {
 port: 8088,
 mediaroot: '/home/ubuntu/projects/amjilt_media/media',
 allow_origin: '*'
 },
 trans: {
 ffmpeg: '/usr/bin/ffmpeg',
 // ffmpeg: 'C:/Users/User/Desktop/ffmpeg/bin/ffmpeg.exe',
 tasks: [
 {
 app: 'live',
 hls: true,
 hlsFlags: '[hls_time=2:hls_list_size=3:hls_flags=delete_segments]',
 dash: true,
 dashFlags: '[f=dash:window_size=3:extra_window_size=5]'
 }
 ]
 }
}

Having problems running my unix ffmpeg script on windows

$
0
0

im trying to run this script for converting between the two formats of VR on a windows machine

ffmpeg -i input.mp4 \
-filter_complex "[0:v]crop=in_w/2:in_h:0:0 [top];
[0:v]crop=in_w/2:in_h:in_w/2:0[bottom];
[top][bottom]vstack,
scale=iw*min(2000/iw\,2000/ih):ih*min(2000/iw\,2000/ih),
pad=2000:2000:(ow-iw)/2:(oh-ih)/2[outv]"
-map "[outv]" -map 0:a -c:a copy output_3dv.mp4

from what ive found i think the \ characters need to be swapped with ^ like this

ffmpeg ^
-i input.mp4 ^
-filter_complex "[0:v]crop=in_w/2:in_h:0:0 [top]; [0:v]crop=in_w/2:in_h:in_w/2:0[bottom]; [top][bottom]vstack, scale=iw*min(2000/iw,2000/ih):ih*min(2000/iw,2000/ih), pad=2000:2000:(ow-iw)/2:(oh-ih)/2[outv]" ^
-map "[outv]" -map 0:a -c:a copy output_3dv.mp4

but its still falling over . would anyone have any pointers one where im going wrong please ? thanks in advance


Evolution #4567: balise introduction

$
0
0

je vais mettre la derniere version 3.3 pour voir

en fait #INTRODUCTION fonctionne car il donne le descriptif

et INTRODUCTION{1000} ne fonctionne pas plus que couper{1000}

 

 

 

 

 

 

 

Message du 03/10/20 18:05
De :
A :
Copie à :
Objet : [SPIP - Evolution #4567] balise introduction

La demande #4567a été mise à jour par RastaPopoulos ♥.
Mais qu'est-ce que tu appelles "les raccourcis portant sur les paragraphes", ça veut dire quoi ?

Le filtre |couper supprime toutes les balises HTML (ça appelle supprier_tags), absolument toutes ! Donc il ne reste déjà que du texte brut à la fin. Donc pourquoi une autre balise, que veux-tu de plus ou de moins ?

Evolution #4567: balise introduction

Auteur: josiane aletto
Statut: Nouveau
Priorité: Normal
Assignéà:
Catégorie:
Version cible: 3.4
Resolution:

avoir l'equivalent de la balise introduction par exemple balise introduction_texte qui va chercher l'introduction uniquement dans le texte avec éventuellement le texte entre intro car ce filtre coupe correctement le texte sans laisser des raccourcis et autre element genant
ou pouvoir couper le texte sans que les raccourcis sur des paragraphes restent dans le texte couper

Vous recevez ce mail car vous êtes impliqués sur ce projet.
Pour changer les préférences d'envoi de mail, allez sur http://core.spip.net/my/account

Evolution #4567: balise introduction

$
0
0

juste mon exemple n'est pas bon il affiche juste le cas couper http://test3.montpellier2.web-ecclesial.fr/spip.php?rubrique16

introduction est visible a http://test3.montpellier2.web-ecclesial.fr/spip.php?rubrique18&var_mode=calcul

 

je confirme #INTRODUCTION fonctionne et #COUPER ne fonctionne pas bien

 

 

 

 

 

 

Message du 03/10/20 18:05
De :
A :
Copie à :
Objet : [SPIP - Evolution #4567] balise introduction

La demande #4567a été mise à jour par RastaPopoulos ♥.
Mais qu'est-ce que tu appelles "les raccourcis portant sur les paragraphes", ça veut dire quoi ?

Le filtre |couper supprime toutes les balises HTML (ça appelle supprier_tags), absolument toutes ! Donc il ne reste déjà que du texte brut à la fin. Donc pourquoi une autre balise, que veux-tu de plus ou de moins ?

Evolution #4567: balise introduction

Auteur: josiane aletto
Statut: Nouveau
Priorité: Normal
Assignéà:
Catégorie:
Version cible: 3.4
Resolution:

avoir l'equivalent de la balise introduction par exemple balise introduction_texte qui va chercher l'introduction uniquement dans le texte avec éventuellement le texte entre intro car ce filtre coupe correctement le texte sans laisser des raccourcis et autre element genant
ou pouvoir couper le texte sans que les raccourcis sur des paragraphes restent dans le texte couper

Vous recevez ce mail car vous êtes impliqués sur ce projet.
Pour changer les préférences d'envoi de mail, allez sur http://core.spip.net/my/account

HTML Video Exporting Using MediaRecorder vs ffmpeg.js

$
0
0

TLDR

Imagine I have one video and one image. I want to create another video that overlays the image (e.g. watermark) at the center for 2 seconds in the beginning of the video and export it as the final video. I need to do this on the client-side only. Is it possible to use MediaRecorder + Canvas or should I resort to using ffmpeg.js?

Context

I am making a browser-based video editor where the user can upload videos and images and combine them. So far, I implemented this by embedding the video and images inside a canvas element appropriately. The data representation looks somewhat like this:

video: {
 url: 'https://archive.com/video.mp4',
 duration: 34,
},
images: [{
 url: 'https://archive.com/img1.jpg',
 start_time: 0,
 end_time: 2,
 top: 30,
 left: 20,
 width: 50,
 height: 50,
}]

Attempts

  1. I play the video and show/hide images in the canvas. Then, I can use the MediaRecorder to capture the canvas' stream and export it as a data blob at the end. The final output is as expected, but the problem with this approach is I need to play the video from the beginning to the end for me to capture the stream from the canvas. If the video is 60 seconds, exporting it also takes 60 seconds.

function record(canvas) {
 return new Promise(function (res, rej) {
 const stream = canvas.captureStream();
 const mediaRecorder = new MediaRecorder(stream);
 const recordedData = [];

 // Register recorder events
 mediaRecorder.ondataavailable = function (event) {
 recordedData.push(event.data);
 };
 mediaRecorder.onstop = function (event) {
 var blob = new Blob(recordedData, {
 type: "video/webm",
 });
 var url = URL.createObjectURL(blob);
 res(url);
 };

 // Start the video and start recording
 videoRef.current.currentTime = 0;
 videoRef.current.addEventListener(
 "play",
 (e) => {
 mediaRecorder.start();
 },
 {
 once: true,
 }
 );
 videoRef.current.addEventListener(
 "ended",
 (e) => {
 mediaRecorder.stop();
 },
 {
 once: true,
 }
 );
 videoRef.current.play();
 });
}
  1. I can use ffmpeg.js to encode the video. I haven't tried this method yet as I will have to convert my image representation into ffmpeg args (I wonder how much work that is).
-- ffmpeg.js

Updating Heroku Buildpack to use ffmpegthumbnailer 2.2.0

$
0
0

The app I am working on is currently using a buildpack that is using ffmpegthumbnailer 2.0.8 and I need a feature that was added in version 2.1.2. I have forked the repo of the buildpack we are currently using https://github.com/akomic/heroku-buildpack-ffmpegthumbnailer and updated the bin/compile file to point the download_url to "https://github.com/dirkvdb/ffmpegthumbnailer/archive/2.2.0.tar.gz" but when I add my forked repo to the app and run heroku run "ffmpegthumbnailer -version" to verify that it worked I get a bash: ffmpegthumbnailer: command not found error.

Here is the original bin/compile:

#!/bin/sh

indent() {
 sed -u 's/^/ /'
}

echo "-----> Install ffmpegthumbnailer"
BUILD_DIR=$1
VENDOR_DIR="vendor"
DOWNLOAD_URL="http://www.aksiom.net/stuff/ffmpegthumbnailer_2.0.8-2.bin.tar.gz"

echo "DOWNLOAD_URL = " $DOWNLOAD_URL | indent

cd $BUILD_DIR
mkdir -p $VENDOR_DIR
cd $VENDOR_DIR
curl -L --silent $DOWNLOAD_URL | tar zx

echo "exporting PATH and LIBRARY_PATH" | indent
PROFILE_PATH="$BUILD_DIR/.profile.d/ffmpeg.sh"
mkdir -p $(dirname $PROFILE_PATH)
echo 'export PATH="$PATH:$HOME/vendor/ffmpegthumbnailer_2.0.8-2/bin"' >> $PROFILE_PATH
echo 'export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/vendor/ffmpegthumbnailer_2.0.8-2/lib"' >> $PROFILE_PATH

Here is my updated bin/compile in the forked repo:

#!/bin/sh

indent() {
 sed -u 's/^/ /'
}

echo "-----> Install ffmpegthumbnailer"
BUILD_DIR=$1
VENDOR_DIR="vendor"
DOWNLOAD_URL="https://github.com/dirkvdb/ffmpegthumbnailer/archive/2.2.0.tar.gz"

echo "DOWNLOAD_URL = " $DOWNLOAD_URL | indent

cd $BUILD_DIR
mkdir -p $VENDOR_DIR
cd $VENDOR_DIR
curl -L --silent $DOWNLOAD_URL | tar zx

echo "exporting PATH and LIBRARY_PATH" | indent
PROFILE_PATH="$BUILD_DIR/.profile.d/ffmpeg.sh"
mkdir -p $(dirname $PROFILE_PATH)
echo 'export PATH="$PATH:$HOME/vendor/ffmpegthumbnailer_2.0.8-2/bin"' >> $PROFILE_PATH
echo 'export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/vendor/ffmpegthumbnailer_2.0.8-2/lib"' >> $PROFILE_PATH

Other info: I add the buildpack using heroku buildpacks:add

Thank you for any help!

-- https://github.com/akomic/heroku-buildpack-ffmpegthumbnailer, https://github.com/dirkvdb/ffmpegthumbnailer/archive/2.2.0.tar.gz

How to I convert all audio tracks to eac3 and keep all subtitles?

$
0
0

I'm not familiar with ffmpeg, but came across this script that takes in the file and creates an output with eac3 audio.

#!/bin/sh

echo "Dolby Digital Plus Muxer"
echo "Developed by @kdcloudy, not affiliated with Dolby Laboratories"
echo "Enter the file name to be converted: "
read filepath
if [! -d $filepath]
then
exit $err
fi

ffmpeg -i $filepath -vn ddp.eac3
ffmpeg -i $filepath -i ddp.eac3 -vcodec copy -c:a eac3 -map 0:s -map 0:v:0 -map 1:a:0 output.mp4
rm ddp.eac3

I'd like to know what to modify in this code to ensure all the subtitles are copied from the original file and all the available audio tracks are converted to eac3 and added to the output.mp4 file. For the subtitles copying I tried -map but couldn't get it to work. Thanks for the help!

Where to find simple YUV (YUV420P possibly) images to test? (can I extract with ffmpeg?)

$
0
0

I need to test an OpenGL shader that renders YUV420P (and other YUV formats) into RGB. Decoding a video just for that would be too much.

Are there any image samples with Y, U, and V buffers for me to send to the shader?

On google I only found old websites that no longer host these images.

Maybe there's a way to easily extract a frame from any video using ffmpeg?

FFMPEG H264 with custom overlay per frame

$
0
0

We have a stream that is stored in the cloud (Amazon S3) as individual H264 frames. The frames are stored as framexxxxxx.264, the numbering doesn't start from 0 but rather from some larger number, say 1000 (so, frame001000.264)

The goal is to create a mp4 clip which is either timelapse or just faster for inspection and other checking (much faster, compressing around 3 hours of video down to < 20 minutes), this also requires we overlay the frame number (the filename) on the frame itself

At first I was creating a timelapse by pulling from S3 only the keyframes (i-frames? still rather new to codecs & stuff) and overlaying the filename on them and saving as png (which probably isn't needed, but that's what I did) using (this command is used inside a python script)

ffmpeg -y -i {h264_name} -vf \"scale=1920:-1, 
drawtext=fontfile=/usr/share/fonts/truetype/ubuntu-font-family/Ubuntu-B.ttf:fontsize=34:text={txt}:fontcolor=white:x=50:y=50:bordercolor=black:borderw=2\"
-c:a copy -pix_fmt yuv420p {basename}.png

after this I combined all the frames by using python to convert the lowest numbered frame to 0.png and incrementing (so it would be continuous, because I only used keyframes the numbers originally weren't sequential) and running

ffmpeg -y -f image2 -i %d.png -r {self.params.fps} -vcodec libx264 -crf {self.params.crf} -pix_fmt yuv420p {out_file}

and this worked great, but the difference between keyframes was too long to allow for proper inspection

so now for the question(s)

since I know frames that are not keyframes (p-frames?) can't be used alone by ffmpeg, the method of overlaying the file name and converting it to png (or keep as h264, same thing) won't work, or at least, I couldn't find a way for it to work, maybe there's a way to specify a frame's keyframe?, how can one overlay the filename (and not the frame number as shown here for example)

Also, is it possible to skip some p-frames between the keyframes? (so if a keyframe is every 30 frames, we would take a keyframe, a frame 15 frames later, and next another keyframe)

I thought about using ffmpeg's pipe option to feed it with the files as they're being downloaded, but I'm not sure if I can specify drawtext this way

Also, if there's another alternative that can achieve that (at first I was converting to png, using python and OpenCV to add the filename and then merging the pngs to mp4, but then I found drawtext can do that in a single command so I used it)


Quickly check the integrity of video files inside a directory with ffmpeg

$
0
0

I'm desperately searching for a convenient method to check the integrity of .mp4 files inside a specific directory with folders in it. Both the names of the .mp4 files and the folders contain spaces, special characters and numbers.

I've already found a proper ffmpeg command to quickly identify a damaged .mp4 file, taken from here: ffmpeg -v error -i filename.mp4 -map 0:1 -f null - 2>error.log

If the created error.log contains some entries, then the file is obviously corrupted. The opposite would be an empty error.log.

The next step would be to apply this command to every .mp4 file within the folder and its subfolders. Some guides, like here and here, do describe how to apply a ffmpeg command recursively, but my coding skills are limited, so therefore I can't find a way to combine these commands to get the following:

A way to test all .mp4 files inside a folder (recursively) with the aforementioned ffmpeg command, that should create .log files, only if a video file does contain errors (read has some content) and it should inherit the name of the broken file, to know which file is corrupted.

Using Ubuntu Gnome 15.10.

Convert Audio to Video (with Poster) and Convert Audio for HLS (Laravel-FFMpeg)

$
0
0

I implemented a code with Laravel and used Laravel-FFMpeg for media processing. I could not find the answers to my questions so I am asking them here and I hope someone can help me.

  • How can I convert an audio file (wav, mp3, etc.) to a video file (mp4) using Laravel-FFmpeg or PHP-FFMpeg (with an image as a poster)?
// something like this command
ffmpeg -loop 1 -i image.jpg -i audio.wav -c:v libx264 -tune stillimage 
-c:a aac -b:a 192k -pix_fmt yuv420p -shortest out.mp4
  • How can I convert an audio file (wav, mp3, etc.) to HLS using Laravel-FFmpeg or PHP-FFMpeg?
    • I did this correctly for the video file and I had no problem but I did not see a sample for the audio file.
    • Is it possible to stream an audio file and convert it to HLS (making ts and m3u8 files)? I mean, do I need to create HLS files to stream audio files on players like Video.js? Does streaming an audio file make sense?
    • Do we need to convert the audio file to a video file first and then build the HLS, or can we build the HLS directly?
  • With this package, can a watermark be placed on a photo? Or wrote a text on it (drawtext command)?
  • How to add album art (jpg) to audio file (mp3) using this package?
// something like this command
ffmpeg -i in.mp3 -i test.png -map 0:0 -map 1:0 -c copy -id3v2_version 3 -metadata:s:v 
title="Album cover" -metadata:s:v comment="Cover (front)" out.mp3

If you provide a sample code of this package or PHP-FFMpeg for the above three questions, I would be grateful.

Thank You

How to call a Rust function that expects a double pointer to buffer

$
0
0

I'm trying to map the following ffmpeg function: http://ffmpeg.org/doxygen/4.0/group__lavc__parsing.html#ga0dd9af605377fcbb49fffd982672d377 to Rust code

int av_parser_parse2 ( AVCodecParserContext * s,
 AVCodecContext * avctx,
 uint8_t ** poutbuf,
 int * poutbuf_size,
 const uint8_t * buf,
 int buf_size,
 int64_t pts,
 int64_t dts,
 int64_t pos 
 ) 

Here's my Rust code sketch:

fn parse2(
 &self, 
 av_codec_context: CodecContext,
 poutbuf: &mut [u8],
 poutbuf_size: &mut i32,
 buf: &[u8],
 pts: i64,
 dts: i64,
 pos: i64,
) -> Result {
 unsafe {// ptr::null(), ptr::null_mut()
 match av_parser_parse2(self.as_mut_ptr(),
 av_codec_context.as_mut_ptr(),
 poutbuf.as_mut_ptr(),
 poutbuf_size.as_mut_ptr(),
 buf.as_mut_ptr(),
 buf.len() as i32,
 pts,
 dts,
 pos
) {
 }
 }
}

Here's the av_parser_parse2 generated by Rust's C bindings:

pub fn av_parser_parse2(
 s: *mut AVCodecParserContext,
 avctx: *mut AVCodecContext,
 poutbuf: *mut *mut u8,
 poutbuf_size: *mut libc::c_int,
 buf: *const u8,
 buf_size: libc::c_int,
 pts: i64,
 dts: i64,
 pos: i64,
) -> libc::c_int

I'm having problems in 2 arguments:

 poutbuf.as_mut_ptr(),
 poutbuf_size.as_mut_ptr(),

How can I make a double pointer? In ffmpeg the user would provide a pointer to an empty buffer and to a size, which would be ovewritten by the function av_parser_parse2. I think I don't want the poutbuf: &mut [u8], poutbuf_size: &mut i32, arguments. Maybe I need to return a fresh new Vec for every parse2 call? So the return value for parse2 would be the tuple Vec, i32.

So I think I should take off poutbuf and poutbuf_size from the arguments, and call av_parser_parse2 with something that will become the Vec to return. However, I cannot pass a Vec as a double pointer, because I do not know the size of the returned packet.

How can I deal with the returned buffer?

-- http://ffmpeg.org/doxygen/4.0/group__lavc__parsing.html#ga0dd9af605377fcbb49fffd982672d377

Is there a way to batch split a file by chapter with ffmpeg and then reassemble with mkvmerge in windows?

$
0
0

So I made a batch script originally with the ability to relatively precision trim a video into chapters without having to run by keyframes, but the code looks horrible and I can't get it to loop through all mp4 files nor get mkvmerge to append the files after splitting them. Code is below but be gentle it is my first try.

@echo off
setlocal enableDelayedExpansion

REM CODE BELOW CREATES JSON FILES FOR ALL MP4 FILES WITHIN THE SAME DIRECTORY
ffprobe -v quiet -print_format json -show_chapters -loglevel error "01x01.mp4">"01x01.json"

REM CODE BELOW SETS VARIABLES FROM EACH SPECIFIC JSON
FOR /F "delims=" %%i in ('jq .chapters[2].start ^< 01x01.json') DO SET /A start1=%%i
FOR /F "delims=" %%j in ('jq .chapters[2].end ^< 01x01.json') DO SET /A end1=%%j

FOR /F "delims=" %%k in ('jq .chapters[4].start ^< 01x01.json') DO SET /A start2=%%k
FOR /F "delims=" %%l in ('jq .chapters[4].end ^< 01x01.json') DO SET /A end2=%%l

FOR /F "delims=" %%m in ('jq .chapters[6].start ^< 01x01.json') DO SET /A start3=%%m
FOR /F "delims=" %%n in ('jq .chapters[6].end ^< 01x01.json') DO SET /A end3=%%n

FOR /F "delims=" %%o in ('jq .chapters[8].start ^< 01x01.json') DO SET /A start4=%%o
FOR /F "delims=" %%p in ('jq .chapters[8].end ^< 01x01.json') DO SET /A end4=%%p

REM SETS THE DURATION OF EACH FILE TO USE PRECISION TIMING FOR START AND STOP TIMES
CALL vbs (%end1%-%start1%)/1000
SET duration1=%val%
CALL vbs (%end2%-%start2%)/1000
SET duration2=%val%
CALL vbs (%end3%-%start3%)/1000
SET duration3=%val%
CALL vbs (%end4%-%start4%)/1000
SET duration4=%val%

REM SETS THE START TIME IN SECONDS VS MILLISECONDS
CALL vbs (%start1%)/1000
SET start1=%val%
CALL vbs (%start2%)/1000
SET start2=%val%
CALL vbs (%start3%)/1000
SET start3=%val%
CALL vbs (%start4%)/1000
SET start4=%val%

REM TRIM AND SPLIT ORIGINAL FILE INTO SEPERATE SECTIONS BASED ON CHAPTER MARKERS
ffmpeg -ss %START1% -i 01x01.mp4 -ss 0 -c copy -to %DURATION1% -avoid_negative_ts make_zero 01x01-1.mp4
ffmpeg -ss %START2% -i 01x01.mp4 -ss 0 -c copy -to %DURATION2% -avoid_negative_ts make_zero 01x01-2.mp4
ffmpeg -ss %START3% -i 01x01.mp4 -ss 0 -c copy -to %DURATION3% -avoid_negative_ts make_zero 01x01-3.mp4
ffmpeg -ss %START4% -i 01x01.mp4 -ss 0 -c copy -to %DURATION4% -avoid_negative_ts make_zero 01x01-4.mp4

REM DELETES UNNEEDED JSON AFTER USE
del /s *.json

REM APPEND ALL MP4 FILES INTO COHESIVE MKV
for /d /r %%D in (*) do (
 pushd %%D
 set files=
 for %%F in (*.mp4) do set files=!files! + ^( "%%F" ^)
 if not "!files!"=="" %mkvmerge% -o "01x01-FINAL.mkv" !files:~2!
 popd
)

REM DELETE UNNEEDED MP4 ORIGINALS AND SPLIT FILES
del /s *.mp4

I know it is super long and every time I try to use a variable or a loop to run through all files it can't read the json file. I've been at this all day and I can use the script as is but I have to make a file for each iteration.

I was also hoping to be able to have it only pull chapters labeled as "video" but I haven't quite figured that one out yet.

I'll add the vbs batch file for the arithmetic section as well as the sample json if it will help.

@echo off
>"%temp%\VBS.vbs" echo Set fso = CreateObject("Scripting.FileSystemObject") : Wscript.echo (%*)
for /f "delims=" %%a in ('cscript /nologo "%temp%\VBS.vbs"') do set "val=%%a"
del "%temp%\VBS.vbs"
{
 "chapters": [
 {
 "id": 0,
 "time_base": "1/1000",
 "start": 0,
 "start_time": "0.000000",
 "end": 5590,
 "end_time": "5.590000",
 "tags": {
 "title": "Video"
 }
 },
 {
 "id": 1,
 "time_base": "1/1000",
 "start": 5590,
 "start_time": "5.590000",
 "end": 13994,
 "end_time": "13.994000",
 "tags": {
 "title": "Advertisement"
 }
 },
 {
 "id": 2,
 "time_base": "1/1000",
 "start": 13994,
 "start_time": "13.994000",
 "end": 163964,
 "end_time": "163.964000",
 "tags": {
 "title": "Video"
 }
 },
 {
 "id": 3,
 "time_base": "1/1000",
 "start": 163964,
 "start_time": "163.964000",
 "end": 195940,
 "end_time": "195.940000",
 "tags": {
 "title": "Advertisement"
 }
 },
 {
 "id": 4,
 "time_base": "1/1000",
 "start": 195940,
 "start_time": "195.940000",
 "end": 547849,
 "end_time": "547.849000",
 "tags": {
 "title": "Video"
 }
 },
 {
 "id": 5,
 "time_base": "1/1000",
 "start": 547849,
 "start_time": "547.849000",
 "end": 595850,
 "end_time": "595.850000",
 "tags": {
 "title": "Advertisement"
 }
 },
 {
 "id": 6,
 "time_base": "1/1000",
 "start": 595850,
 "start_time": "595.850000",
 "end": 1413588,
 "end_time": "1413.588000",
 "tags": {
 "title": "Video"
 }
 },
 {
 "id": 7,
 "time_base": "1/1000",
 "start": 1413588,
 "start_time": "1413.588000",
 "end": 1477569,
 "end_time": "1477.569000",
 "tags": {
 "title": "Advertisement"
 }
 },
 {
 "id": 8,
 "time_base": "1/1000",
 "start": 1477569,
 "start_time": "1477.569000",
 "end": 1529696,
 "end_time": "1529.696000",
 "tags": {
 "title": "Video"
 }
 }
 ]
}

I also tried using the start_time so I didn't have to do extra calculations but jq didn't like that either.

mkvmerge doesn't even try to run when I have it in here and I still need to cut 7 seconds off the end and 12 seconds off the front of it once it is all one file again.

Any help would be appreciated, I know it's a lot but I seem to have hit a roadblock or just sleep deprived at this point.

FFMpeg Add Background Music to Video

$
0
0

I wanna add a background music on my video. I tried this command

ffmpeg -i video.mkv -i audio.m4a -filter_complex "[0:a][1:a]amerge=inputs=2[a]" -map 0:v -map "[a]" -c:v copy -ac 2 output.mkv

It worked but when music ended, My Video Sound end too. I want to repeate the background music until video end. And if I can change background music volume it will be awosome

Viewing all 117670 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>