Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Transcoding rtsp over http
24 novembre 2016, par NikiDonBefore I explain my problem : Sorry for bad English and if you want you can help me on my spelling too.
I have a low cost IP camera who give only a RTSP link : 192.168.x.x/onvif2 It doesn't need authentication to see video... my router doesn't have open ports^^
I want to trancode rtsp ( because of html can't play it) with FFMPEG to send it on a server node.js ( express ) and in index.html play stream in video tag :
Server.js :
<script>
var express = require('express');
var path = require('path');
var app = express();
var server = require('http').Server(app);
var io = require('socket.io')(server);
app.use(express.static(path.join(__dirname, 'public')));
app.get('/', function (req, res) {
res.sendFile(__dirname + '/index.html');
});
server.listen(8080);
console.log("server run at 127.0.0.1:8080");
io.on('connection',function(socket){
socket.emit('hello','hello user');
});
</script>and index.html :
<script>
ffmpeg -i rtsp://192.168.x.x/onvif2 -crf 30 -preset ultrafast -acodec aac -strict experimental -ar 44100 -ac 2 -b:a 96k -vcodec libx264 -r 25 -b:v 500k -f flv http://127.0.0.1:xx/vid2.mp4
var socket = io.connect();
socket.on('hello',function(data){
console.log(data);
});
</script>The camera starts but I can't find vid2.mp4
How can I replace ffserver with a node server (http? udp?...)
-
use ffmpeg.exe in Webservice hosted on Android
24 novembre 2016, par ikazzazI want to use ffmpeg with a Webservice hosted on Android. I include the "ffmpeg.exe" in "myservice.war" package and deploy it on i-jetty server. Problem I get is that "ffmpeg.exe" is not found when calling the service that runs ffmpeg command!! Any ideas why/how to solve this problem? Thank you!
-
Number of audio tracks in mp4 container
24 novembre 2016, par RajIs there any limit on how many audio tracks can be muxed within a mp4 container format? If yes, what is the maximum number of audio tracks I can package in MP4 container? does HLS has any maximum number audio track support? Many thanks in advance.
-
Ubuntu Compile C++ Application With ffmpeg and sdl2 [on hold]
24 novembre 2016, par Antonio GagliardiI've tried to compile a c++ application that use ffmpeg and SDL 2 in eclipse.
The application is simple:
#include
extern "C"{ #include imgutils.h> #include avcodec.h> #include swscale.h> #include avformat.h> } using namespace std; int main() { cout << "Test ffmpeg" << endl; av_register_all(); return 0; } Then I've set in project properties the library (-l):
avformat avcodec faac mp3lame fdk-aac vpx x264 avdevice avutil swscale rt vorbisenc va pthread dl
The path of ffmpeg build in libray search path (-L) the ffmpeg include path (-l)
I've also set the dialet to c++11
When i try to compile, I receive lots errors. By googling i found that the problem can be the library order include.
Any help is appreciated.
-
How to run ffmpeg in a loop and test it for error ?
24 novembre 2016, par David CabreraI have stuttering, seeking, and general playback issues when playing large mkv files through my Plex Media Server setup. I have been looking around for a way to automate scheduled tasks to move everything to mp4. The objective is:
Copy mkv files into mp4 preserving subtitles of every kind. Put the new file in the same subdir, and delete previous mkv version if conversion went successful.
When I tried to run ffmpeg on a loop, I run into the problem described here:
http://unix.stackexchange.com/questions/36310/strange-errors-when-using-ffmpeg-in-a-loop
This is my first adventure on shell scripting and I am pretty much stumbling around and trying to understand the syntax and philosophy of it. What I understand is that they use a file descriptor to redirect ffmpeg output to /dev/null.
The problem with that solution is that I would need to check ffmpeg output for errors to decide whether to delete the previous file or not. Furthermore, there is a common error when converting from picture based subtitles streams, which I circumvent by using a script I found (http://www.computernerdfromhell.com/blog/automatically-extract-subtitles-from-mkv/) to work after some modifications to my needs.
After much frustration I ended modifying the script so much that it does not serve to its purpose. It does not check for errors. Anyways, I will post it here. Mind you that this is my first shell script ever, and almost everything is confusing about it. The problem with this, is that I had to ditch my error checking and I am eliminating files that errored when converting. Losing the original without a valid copy.
#!/bin/bash FOLDERS=( "/mnt/stg4usb/media0/test/matroska1" "/mnt/stg4usb/media0/test/season1" "/mnt/stg4usb/media0/test/secondtest") FLAGS="-y -metadata title="" -c:v copy -map 0 -c:a libfdk_aac -ac 2 -movflags +faststart" COUNTER=0 LOGFILE=batch-$(date +"%Y%m%d-%H%M%S").log for FOLDER in "${FOLDERS[@]}" do echo "---===> STARTING folder: '$FOLDER'" find $FOLDER -name "*.mkv" | while read line; do OUTPUT="" DATE=$(date +"%Y-%m-%d") TIME=$(date +"%H:%M:%S") COUNTER=$((COUNTER+1)) FILE=$(basename "$line") DIR=$(dirname "${line}") echo $'\n'$'\n'"[$COUNTER][$DATE][$TIME][FILE:'${line%.mkv}.mp4']"$'\n' echo "#### Transcoding ####"'\n' ffmpeg -i $line $FLAGS -sn "${line%.mkv}.mp4" < /dev/null echo "#### Extracting subtitles ###"'\n''\n' mkvmerge -i "$line" | grep 'subtitles' | while read subline do # Grep the number of the subtitle track tracknumber=`echo $subline | egrep -o "[0-9]{1,2}" | head -1` # Get base name for subtitle subtitlename=${line%.*} # Extract the track to a .tmp file mkvextract tracks "$line" $tracknumber:"$subtitlename.$tracknumber.srt" < /dev/null chmod g+rw "$subtitlename.$tracknumber"* < /dev/null done rm -frv "$line" < /dev/null echo "Finished: $(date +"%Y%m%d-%H%M%S")" done echo '\n'"<===--- DONE with folder: '$FOLDER'"$'\n'$'\n' >> $LOGFILE done exit 0
So, basically, the idea is: run ffmpeg on a loop for all mkv under a directory and subdirectories (I was using find). Check it for all possible errors. If errors, try again without subtitles and extract the subtitles using mkvextract, else everything went ok, and delete the previous file.