Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
Separate speakers from stereo microphones
27 août 2017, par AlexI have two audio tracks of dialogue - first - speech of client, second - speech of manager. The recording is done with two microphone. Unfortunnatelly every of recording contains the little sound of each other (for example the audio with client contains the soft voice of manager). How I can сlearly separate this audios?
-
`FFmpeg` `segment_time` inserts blank frames at the beginning of segment
27 août 2017, par asdfI am using the following command to cut videos in parts. I need parts to be less than passed max_length param, I do not need precise cuts.
ffmpeg -i input.mov \ -segment_time 20 -f segment -reset_timestamps 1 input_%d.mov
Every first part video file cut by
ffmpeg
is not 20s, but 20.5s long. And it has several black frames at the beginning inserted byffmpeg
.I don't mind having 19.5s long parts if that is needed because of keyframes. But I need to get rid of those black frames at the beginning so that videos cut in parts could be concatenated in a single video later without any troubles.
Could you give me an advice?
Upd:
There were no black frames in an original video which was 23 seconds long. I made a cut setting 12 as a segment length.
I also had to add
-c copy
because I would like to keep original quality if that's possible.Leading black frames were added after a cut to part 1 which is 12 seconds long.
Trailing black frames were added after a cut to part 2 which is 10 seconds long.
https://www.dropbox.com/sh/zo8evta3w1xho3o/AABpTB3w3CuPa1WcghkSIVfna?dl=0
The command used was
ffmpeg -y -i /Users/nt/Desktop/cut/AAL_CrSlowMo_041413_1.mov -c copy -segment_time 12 -f segment -reset_timestamps 1 /Users/nt/Desktop/cut/AAL_CrSlowMo_041413_1_%d.mov
Here's output of
ffmpeg
: https://gist.github.com/nmtitov/ad102539f95fa03b95f10a46f8d99663 -
rtsp to rtmp using ffmpeg or any tool wrapper
27 août 2017, par ChakriI have a requirement where I need to restream the RTSP stream from camera source to RTMP server. I know this may sound a repeated question but my exact scenario is I cannot do it manually over command line with ffmpeg command. I need a wrapper where I receive the rtsp and rtmp url from external source say through REST invocation. Then the code can trigger the ffmpeg restream.
Basically flow is like this:
- Camera source application sends RTSP read event(could be basic HTTP(REST) request with RTSP url, metadata about camera info, serial no etc) to my streamer app
Ex: /usr/bin/ffmpeg -i rtsp://10.144.11.22:554/stream1 -f flv rtmp://10.13.11.121:1935/stream1
Streamer app computes the RTMP server url for corresponding camera and triggers a ffmpeg command to stream RTSP to RTMP
Streamer app triggers above(2) in separate thread and keeps reading the logs for monitoring purpose. Also identifies the end of RTSP stream and sends an update(Example: RTSP END) event to UI
Now at point(2) I need a suggestion. Here I need a stable wrapper/api which can help. I tried this through some Java wrappers but the process hangs or fails to read the output from ffmpeg. Also I need to handle streams from many cameras where spawning thread for each one could be exhaustive.
So I am looking for some similar api/wrapper in C++ or Go Lang which might have more closer interaction in handling ffmpeg command.
Please point if similar issue is addressed elsewhere
-
ffmpeg : rollover of segment numbering when restart encoding
27 août 2017, par Bino Oetomomy ffmpeg command is :
ffmpeg -i http://someaddress.bno/live01.m3u8 \ -c:v copy -c:a aac \ -strict -2 \ -hls_time 20 \ -hls_list_size 15 \ -hls_wrap $3 \ -hls_segment_filename /opt/videoroot/%010d.ts \ -f hls /opt/videoroot/index.m3u8
First run segment files :
-rw-rw-r-- 1 bino bino 975156 Agu 27 07:03 0000000000.ts -rw-rw-r-- 1 bino bino 1102808 Agu 27 07:03 0000000001.ts -rw-rw-r-- 1 bino bino 868936 Agu 27 07:04 0000000002.ts -rw-rw-r-- 1 bino bino 1074232 Agu 27 07:04 0000000003.ts -rw-rw-r-- 1 bino bino 1017832 Agu 27 07:04 0000000004.ts -rw-rw-r-- 1 bino bino 917064 Agu 27 07:05 0000000005.ts -rw-rw-r-- 1 bino bino 968952 Agu 27 07:05 0000000006.ts -rw-rw-r-- 1 bino bino 839984 Agu 27 07:05 0000000007.ts -rw-rw-r-- 1 bino bino 261508 Agu 27 07:05 0000000008.ts -rw-rw-r-- 1 bino bino 494252 Agu 27 07:01 0000000009.ts -rw-rw-r-- 1 bino bino 1014824 Agu 27 07:02 0000000010.ts -rw-rw-r-- 1 bino bino 929660 Agu 27 07:02 0000000011.ts -rw-rw-r-- 1 bino bino 1062388 Agu 27 07:02 0000000012.ts -rw-rw-r-- 1 bino bino 943572 Agu 27 07:02 0000000013.ts -rw-rw-r-- 1 bino bino 991512 Agu 27 07:03 0000000014.ts
First index.m3u8 :
#EXTM3U #EXT-X-VERSION:3 #EXT-X-TARGETDURATION:20 #EXT-X-MEDIA-SEQUENCE:39 #EXTINF:10.000000, 0000000009.ts #EXTINF:20.000000, 0000000010.ts #EXTINF:20.000000, 0000000011.ts #EXTINF:20.000000, 0000000012.ts #EXTINF:20.000000, 0000000013.ts #EXTINF:20.000000, 0000000014.ts #EXTINF:20.000000, 0000000000.ts #EXTINF:20.000000, 0000000001.ts #EXTINF:20.000000, 0000000002.ts #EXTINF:20.000000, 0000000003.ts #EXTINF:20.000000, 0000000004.ts #EXTINF:20.000000, 0000000005.ts #EXTINF:20.000000, 0000000006.ts #EXTINF:20.000000, 0000000007.ts #EXTINF:5.866667, 0000000008.ts #EXT-X-ENDLIST
I quit encoding, and re-run.
2nd run segment files : -rw-rw-r-- 1 bino bino 911048 Agu 27 07:10 0000000000.ts -rw-rw-r-- 1 bino bino 924960 Agu 27 07:10 0000000001.ts -rw-rw-r-- 1 bino bino 1046972 Agu 27 07:10 0000000002.ts -rw-rw-r-- 1 bino bino 953348 Agu 27 07:11 0000000003.ts -rw-rw-r-- 1 bino bino 1030804 Agu 27 07:11 0000000004.ts -rw-rw-r-- 1 bino bino 1022532 Agu 27 07:12 0000000005.ts -rw-rw-r-- 1 bino bino 926276 Agu 27 07:12 0000000006.ts -rw-rw-r-- 1 bino bino 1023848 Agu 27 07:12 0000000007.ts -rw-rw-r-- 1 bino bino 980044 Agu 27 07:12 0000000008.ts -rw-rw-r-- 1 bino bino 941128 Agu 27 07:13 0000000009.ts -rw-rw-r-- 1 bino bino 1109388 Agu 27 07:13 0000000010.ts -rw-rw-r-- 1 bino bino 439732 Agu 27 07:13 0000000011.ts -rw-rw-r-- 1 bino bino 1062388 Agu 27 07:02 0000000012.ts -rw-rw-r-- 1 bino bino 943572 Agu 27 07:02 0000000013.ts -rw-rw-r-- 1 bino bino 991512 Agu 27 07:03 0000000014.ts
note the first 0000000000.ts is Agu 27 07:03, while the second is Agu 27 07:10.
2nd run index.m3u8 :
#EXTM3U #EXT-X-VERSION:3 #EXT-X-TARGETDURATION:21 #EXT-X-MEDIA-SEQUENCE:0 #EXTINF:20.049511, 0000000000.ts #EXTINF:20.000000, 0000000001.ts #EXTINF:20.000000, 0000000002.ts #EXTINF:20.000000, 0000000003.ts #EXTINF:20.000000, 0000000004.ts #EXTINF:20.000000, 0000000005.ts #EXTINF:20.000000, 0000000006.ts #EXTINF:20.000000, 0000000007.ts #EXTINF:20.000000, 0000000008.ts #EXTINF:20.000000, 0000000009.ts #EXTINF:20.000000, 0000000010.ts #EXTINF:9.966667, 0000000011.ts #EXT-X-ENDLIST
My question is : how to make the 2nd run to start with diferent segment number ?
What I want is :
A. Segment files : segment numbers start with 0000000008.ts (last segment in first index.m3u8) rather than 0000000000.ts note the first 0000000000.ts is Agu 27 07:03, while the second is Agu 27 07:10.
B. index.m3u8 ,
#EXTM3U #EXT-X-VERSION:3 #EXT-X-TARGETDURATION:20 #EXT-X-MEDIA-SEQUENCE:40 #EXTINF:5.866667, 0000000008.ts #EXTINF:10.000000, 0000000009.ts #EXTINF:20.000000, 0000000010.ts #EXTINF:20.000000, 0000000011.ts #EXTINF:20.000000, 0000000012.ts #EXTINF:20.000000, 0000000013.ts #EXTINF:20.000000, 0000000014.ts #EXTINF:20.000000, 0000000000.ts #EXTINF:20.000000, 0000000001.ts #EXTINF:20.000000, 0000000002.ts #EXTINF:20.000000, 0000000003.ts #EXTINF:20.000000, 0000000004.ts #EXTINF:20.000000, 0000000005.ts #EXTINF:20.000000, 0000000006.ts #EXTINF:20.000000, 0000000007.ts #EXT-X-ENDLIST
Kindly please give me your enlightenment
sincerely
-bino-
-
Java execute command doesn't work in code
27 août 2017, par ArianaI am calling java.lang.Runtime.exec(...) in my Java program to run a command (some
FFMPEG
commands) simply passed to my function:private static void RunCommand(String command) throws InterruptedException { try { // Execute command Process proc = Runtime.getRuntime().exec(command); } }
It runs OK for simple FFMPEG cases such as
ffmpeg -i input.avi -c copy output.avi
.But for one of the commands, apparently it doesn't run. When I copy/paste the exact String in command line, I am able to run it and see the output file.
ffmpeg -i "concat:/home/temp10.avi|/home/p2.avi|/home/temp15.avi" -c copy -y /home/output.avi
Which is the following in code:
String c4="ffmpeg -i \"concat:"+dir+temp1+"|"+dir+ad+"|"+dir+temp3+"\" -c copy -y "+dir+output;
What is going on? Any guesses why it doesn't run in code? If the
"
is causing the problem, why the corresponding string looks good?!