Newest 'ffmpeg' Questions - Stack Overflow
Les articles publiés sur le site
-
archive ffmpeg all objs into one lib, feasible ?
17 septembre 2014, par Lynn YuI've build ffmpeg static libraries, generated: libavformat.a, libavcodec.a, libavutil.a, ...
in their source directories, all necessary objs (*.o) generated.
I use 'ar' to archive all these objs into one libffmpeg.a.
command: ar rc libffmpeg.a *.o.
I notice that, there are some objs have same name in diff dirs, for example libavformat/4xm.o and libavcodec/4xm.o.
by 'nm libffmpeg.a', it seems both objs are there?
I'm NOT sure.
if obj with same name and Exactly with same function symbols, latter one will be replaced ,right?
by this 'ar' way, will libffmpeg.a work correctly? because there so many symbols I can't test every one.
thanks for help!
-
Quicktime cannot play recorded mp4 video file
17 septembre 2014, par DudeI have an mp4 related issue. I’m not very good in video processing related stuff. We have a problem with an image file that is recorded via HTTP Live Streaming (HLS) from a live stream. The HLS chunks are just put together and saved on the file system as .mp4 file. This file cannot be played with Apple QuickTime. VLC can play it. But it is a requirement that it can be played with QuickTime.
However, I found a solution that works. When I use the ffmpeg command -reset_timestamps, the video file can be played with QuickTime. I also see which parameter changes. It’s the start value.
Before use of the command:
ffmpeg -i recorded_file.mp4 ffmpeg version 1.2.4 Copyright (c) 2000-2013 the FFmpeg developers built on Jan 9 2014 09:06:57 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn) configuration: --prefix=/usr/local/Cellar/ffmpeg/1.2.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid libavutil 52. 18.100 / 52. 18.100 libavcodec 54. 92.100 / 54. 92.100 libavformat 54. 63.104 / 54. 63.104 libavdevice 54. 3.103 / 54. 3.103 libavfilter 3. 42.103 / 3. 42.103 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 [h264 @ 0x7fcb7b015a00] non-existing SPS 2 referenced in buffering period [h264 @ 0x7fcb7b015a00] non-existing PPS referenced [h264 @ 0x7fcb7b015a00] non-existing SPS 2 referenced in buffering period [h264 @ 0x7fcb7b015a00] non-existing PPS 0 referenced [h264 @ 0x7fcb7b015a00] decode_slice_header error [h264 @ 0x7fcb7b015a00] no frame! [mpegts @ 0x7fcb7b004a00] max_analyze_duration 5000000 reached at 5013333 microseconds [mpegts @ 0x7fcb7b004a00] Could not find codec parameters for stream 2 (Unknown: none ([21][0][0][0] / 0x0015)): unknown codec Consider increasing the value for the 'analyzeduration' and 'probesize' options [NULL @ 0x7fcb7b016a00] start time is not set in estimate_timings_from_pts Input #0, mpegts, from 'recorded_file.mp4': Duration: 00:25:00.01, start: 68428.580933, bitrate: 1499 kb/s Program 1 Stream #0:0[0x100]: Video: h264 (High) ([27][0][0][0] / 0x001B), yuv420p, 1024x576 [SAR 1:1 DAR 16:9], 25 fps, 25 tbr, 90k tbn, 50 tbc Stream #0:1[0x101]: Audio: aac ([15][0][0][0] / 0x000F), 48000 Hz, stereo, fltp, 124 kb/s Stream #0:2[0x102]: Unknown: none ([21][0][0][0] / 0x0015)
Use of the command:
ffmpeg -i recorded_file.mp4 output.mp4 -reset_timestamps 0
File after use of the command:
ffmpeg -i output.mp4 ffmpeg version 1.2.4 Copyright (c) 2000-2013 the FFmpeg developers built on Jan 9 2014 09:06:57 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn) configuration: --prefix=/usr/local/Cellar/ffmpeg/1.2.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid libavutil 52. 18.100 / 52. 18.100 libavcodec 54. 92.100 / 54. 92.100 libavformat 54. 63.104 / 54. 63.104 libavdevice 54. 3.103 / 54. 3.103 libavfilter 3. 42.103 / 3. 42.103 libswscale 2. 2.100 / 2. 2.100 libswresample 0. 17.102 / 0. 17.102 libpostproc 52. 2.100 / 52. 2.100 Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'output.mp4': Metadata: major_brand : isom minor_version : 512 compatible_brands: isomiso2avc1mp41 encoder : Lavf54.63.104 Duration: 00:25:00.04, start: 0.021333, bitrate: 1358 kb/s Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1024x576 [SAR 1:1 DAR 16:9], 1224 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc Metadata: handler_name : VideoHandler Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 127 kb/s Metadata: handler_name : SoundHandler
A lot of the text output changes but the line with the duration, start and bitrate is interesting, as the start value is set to near zero.
Duration: 00:25:00.04, start: 0.021333, bitrate: 1358 kb/s
So to use this solution would be enough. The problem is, I cannot use ffmpeg in the solution that downloads the file (it's for Android). So I try to find a way to do this in Java. However, as I have not much experience in Video processing, I can’t figure out, what this ffmpeg command does and therefore don’t know in which direction to look for a Java solution.
Is there a library that may do the same operation in Java or is there an easy way to do it myself in Java (like adjusting the file timestamp)?
Thanks for you help!
EDIT: The whole console output is now shown, instead of just a part of it.
-
Extract CC(Closed Caption) data from .ts file using ffmpeg
17 septembre 2014, par mail2vgunaI am using the following ffmpeg command to extract the CC(Closed Caption) data from .ts file.
ffmpeg -i input.ts -an -vn -bsf:s mov2textsub -scodec copy -f rawvideo sub.txt FFMPEG -i input.ts -vn -an -codec:s:0.1 srt sub.srt ffmpeg -threads 4 -i input.ts -vn -an -codec:s:0.2 srt englishSubtitle.srt
But i did not get the cc data, its says "invalid frame dimensions 0x0" error.
Help me to extract the cc data from .ts file using ffmpeg.
-
x11grab flickers in OpenGL draw areas [on hold]
17 septembre 2014, par Cameron BallI use ffmpeg's x11grab to do some screencasting. It works pretty well except on 3D stuff. In particular it seems like 3D draw areas flicker in and out. You can see an example of it here
The issue is present even when I capture only the screen (i.e., not adding in all the other fancy stuff and the webcam capture).
I've done a lot of googling on this issue and have found people with a similar issue, but no solution. Many suggest that it is due to OpenGL rendering directly to the hardware and bypassing X11 entirely.
Does anyone know of a way to deal with this? If it matters I'm using an nVidia graphics card.
-
Filter complex apply on ffmpeg for android outputs low quality video
17 septembre 2014, par AlinI finally managed to build ffmpeg as detailed in here: https://enoent.fr/blog/2014/06/20/compile-ffmpeg-for-android/ and in the end, I have a ffmpeg library which accepts command arguments.
I am trying to apply a watermark image over the video so for it I am using preparing this ffmpeg command:
ffmpeg -i input.avi -i logo.png -filter_complex 'overlay=10:main_h-overlay_h-10' output.avi
I have first tried it on windows using ffmpeg.exe and the result was as expected.
I have tried it on android using the compiled android and the output is as follows:
09-17 01:16:57.156: I/Videokit(1229): Loading native library compiled at 22:33:10 Sep 15 2014 09-17 01:16:57.156: I/Videokit(1229): Option: ffmpeg 09-17 01:16:57.156: I/Videokit(1229): Option: -loglevel 09-17 01:16:57.156: I/Videokit(1229): Option: debug 09-17 01:16:57.156: I/Videokit(1229): Option: -i 09-17 01:16:57.156: I/Videokit(1229): Option: /storage/emulated/0/mute.mp4 09-17 01:16:57.156: I/Videokit(1229): Option: -i 09-17 01:16:57.156: I/Videokit(1229): Option: /storage/emulated/0/logo.png 09-17 01:16:57.156: I/Videokit(1229): Option: -filter_complex 09-17 01:16:57.156: I/Videokit(1229): Option: overlay=10:main_h-overlay_h-10 09-17 01:16:57.156: I/Videokit(1229): Option: /storage/emulated/0/outVid.mp4 09-17 01:16:57.156: I/Videokit(1229): Running main 09-17 01:16:57.163: D/Videokit(1229): Splitting the commandline. 09-17 01:16:57.163: D/Videokit(1229): Reading option '-loglevel' ... 09-17 01:16:57.163: D/Videokit(1229): matched as option 'loglevel' (set logging level) with argument 'debug'. 09-17 01:16:57.163: D/Videokit(1229): Reading option '-i' ... 09-17 01:16:57.163: D/Videokit(1229): matched as input file with argument '/storage/emulated/0/mute.mp4'. 09-17 01:16:57.163: D/Videokit(1229): Reading option '-i' ... 09-17 01:16:57.163: D/Videokit(1229): matched as input file with argument '/storage/emulated/0/logo.png'. 09-17 01:16:57.163: D/Videokit(1229): Reading option '-filter_complex' ... 09-17 01:16:57.163: D/Videokit(1229): matched as option 'filter_complex' (create a complex filtergraph) with argument 'overlay=10:main_h-overlay_h-10'. 09-17 01:16:57.163: D/Videokit(1229): Reading option '/storage/emulated/0/outVid.mp4' ... 09-17 01:16:57.163: D/Videokit(1229): matched as output file. 09-17 01:16:57.163: D/Videokit(1229): Finished splitting the commandline. 09-17 01:16:57.163: D/Videokit(1229): Parsing a group of options: global . 09-17 01:16:57.163: D/Videokit(1229): Applying option loglevel (set logging level) with argument debug. 09-17 01:16:57.163: D/Videokit(1229): Applying option filter_complex (create a complex filtergraph) with argument overlay=10:main_h-overlay_h-10. 09-17 01:16:57.163: D/Videokit(1229): Successfully parsed a group of options. 09-17 01:16:57.163: D/Videokit(1229): Parsing a group of options: input file /storage/emulated/0/mute.mp4. 09-17 01:16:57.163: D/Videokit(1229): Successfully parsed a group of options. 09-17 01:16:57.163: D/Videokit(1229): Opening an input file: /storage/emulated/0/mute.mp4. 09-17 01:16:57.296: D/Videokit(1229): Successfully opened the file. 09-17 01:16:57.296: D/Videokit(1229): Parsing a group of options: input file /storage/emulated/0/logo.png. 09-17 01:16:57.296: D/Videokit(1229): Successfully parsed a group of options. 09-17 01:16:57.296: D/Videokit(1229): Opening an input file: /storage/emulated/0/logo.png. 09-17 01:16:57.304: D/Videokit(1229): Successfully opened the file. 09-17 01:16:57.304: D/Videokit(1229): Parsing a group of options: output file /storage/emulated/0/outVid.mp4. 09-17 01:16:57.304: D/Videokit(1229): Successfully parsed a group of options. 09-17 01:16:57.304: D/Videokit(1229): Opening an output file: /storage/emulated/0/outVid.mp4. 09-17 01:16:57.312: D/Videokit(1229): Successfully opened the file. 09-17 01:16:57.351: I/Videokit(1229): Stream mapping: 09-17 01:16:57.351: I/Videokit(1229): Stream #0:0 (h264) -> overlay:main 09-17 01:16:57.351: I/Videokit(1229): Stream #1:0 (png) -> overlay:overlay 09-17 01:16:57.351: I/Videokit(1229): overlay 09-17 01:16:57.351: I/Videokit(1229): -> Stream #0:0 (mpeg4) 09-17 01:16:57.351: I/Videokit(1229): Press [q] to stop, [?] for help 09-17 01:16:57.890: I/Videokit(1229): frame= 12 fps=0.0 q=24.3 size= 113kB time=00:00:00.40 bitrate=2314.9kbits/s 09-17 01:16:58.413: I/Videokit(1229): frame= 26 fps= 25 q=31.0 size= 154kB time=00:00:00.86 bitrate=1455.1kbits/s 09-17 01:16:58.953: I/Videokit(1229): frame= 38 fps= 24 q=31.0 size= 180kB time=00:00:01.26 bitrate=1165.0kbits/s 09-17 01:17:00.085: I/Videokit(1229): frame= 50 fps= 24 q=31.0 size= 205kB time=00:00:01.66 bitrate=1006.8kbits/s 09-17 01:17:00.163: I/Videokit(1229): frame= 51 fps= 19 q=31.0 size= 206kB time=00:00:01.70 bitrate= 992.8kbits/s 09-17 01:17:00.632: I/Videokit(1229): frame= 64 fps= 20 q=31.0 size= 230kB time=00:00:02.13 bitrate= 883.9kbits/s 09-17 01:17:01.156: I/Videokit(1229): frame= 78 fps= 21 q=31.0 size= 254kB time=00:00:02.60 bitrate= 798.5kbits/s 09-17 01:17:01.679: I/Videokit(1229): frame= 92 fps= 21 q=31.0 size= 275kB time=00:00:03.06 bitrate= 734.7kbits/s 09-17 01:17:02.179: I/Videokit(1229): frame= 106 fps= 22 q=31.0 size= 296kB time=00:00:03.53 bitrate= 684.8kbits/s 09-17 01:17:02.726: I/Videokit(1229): frame= 121 fps= 23 q=24.8 size= 325kB time=00:00:04.03 bitrate= 660.1kbits/s 09-17 01:17:03.249: I/Videokit(1229): frame= 134 fps= 23 q=31.0 size= 344kB time=00:00:04.47 bitrate= 629.8kbits/s 09-17 01:17:03.781: I/Videokit(1229): frame= 147 fps= 23 q=31.0 size= 368kB time=00:00:04.90 bitrate= 614.2kbits/s 09-17 01:17:04.335: I/Videokit(1229): frame= 159 fps= 23 q=31.0 size= 390kB time=00:00:05.30 bitrate= 602.1kbits/s 09-17 01:17:04.921: I/Videokit(1229): frame= 171 fps= 23 q=31.0 size= 412kB time=00:00:05.70 bitrate= 591.3kbits/s 09-17 01:17:05.437: I/Videokit(1229): frame= 183 fps= 23 q=31.0 size= 432kB time=00:00:06.10 bitrate= 579.8kbits/s 09-17 01:17:05.937: I/Videokit(1229): frame= 196 fps= 23 q=31.0 size= 453kB time=00:00:06.53 bitrate= 568.0kbits/s 09-17 01:17:06.453: I/Videokit(1229): frame= 210 fps= 23 q=31.0 size= 483kB time=00:00:07.00 bitrate= 565.2kbits/s 09-17 01:17:06.976: I/Videokit(1229): frame= 224 fps= 23 q=31.0 size= 513kB time=00:00:07.47 bitrate= 562.3kbits/s 09-17 01:17:07.515: I/Videokit(1229): frame= 239 fps= 24 q=31.0 size= 538kB time=00:00:07.97 bitrate= 553.1kbits/s 09-17 01:17:08.007: I/Videokit(1229): frame= 249 fps= 23 q=31.0 size= 559kB time=00:00:08.30 bitrate= 551.2kbits/s 09-17 01:17:08.531: I/Videokit(1229): frame= 262 fps= 24 q=31.0 size= 581kB time=00:00:08.74 bitrate= 544.6kbits/s 09-17 01:17:09.359: I/Videokit(1229): frame= 272 fps= 23 q=31.0 size= 602kB time=00:00:09.07 bitrate= 543.1kbits/s 09-17 01:17:09.882: I/Videokit(1229): frame= 284 fps= 23 q=31.0 size= 624kB time=00:00:09.47 bitrate= 539.5kbits/s 09-17 01:17:10.374: I/Videokit(1229): frame= 296 fps= 23 q=31.0 size= 651kB time=00:00:09.87 bitrate= 540.2kbits/s 09-17 01:17:10.898: I/Videokit(1229): frame= 309 fps= 23 q=31.0 size= 682kB time=00:00:10.31 bitrate= 542.1kbits/s 09-17 01:17:11.406: I/Videokit(1229): frame= 324 fps= 23 q=31.0 size= 710kB time=00:00:10.81 bitrate= 538.3kbits/s 09-17 01:17:11.929: I/Videokit(1229): frame= 343 fps= 24 q=31.0 size= 749kB time=00:00:11.44 bitrate= 536.2kbits/s 09-17 01:17:12.437: I/Videokit(1229): frame= 361 fps= 24 q=24.8 size= 787kB time=00:00:12.04 bitrate= 535.3kbits/s 09-17 01:17:12.953: I/Videokit(1229): frame= 379 fps= 24 q=31.0 size= 821kB time=00:00:12.64 bitrate= 531.8kbits/s 09-17 01:17:13.460: I/Videokit(1229): frame= 397 fps= 25 q=24.8 size= 869kB time=00:00:13.24 bitrate= 537.2kbits/s 09-17 01:17:13.960: I/Videokit(1229): frame= 413 fps= 25 q=31.0 size= 903kB time=00:00:13.78 bitrate= 537.0kbits/s 09-17 01:17:14.468: I/Videokit(1229): frame= 430 fps= 25 q=31.0 size= 942kB time=00:00:14.34 bitrate= 537.7kbits/s 09-17 01:17:14.601: V/Videokit(1229): No more output streams to write to, finishing. 09-17 01:17:14.609: I/Videokit(1229): frame= 435 fps= 25 q=31.0 Lsize= 959kB time=00:00:14.51 bitrate= 541.2kbits/s 09-17 01:17:14.609: I/Videokit(1229): video:956kB audio:0kB subtitle:0 data:0 global headers:0kB muxing overhead 0.275524% 09-17 01:17:14.609: D/Videokit(1229): 439 frames successfully decoded, 0 decoding errors 09-17 01:17:14.617: I/Videokit(1229): Main ended with status 0
The problem is that the output on android has very poor quality How can I make ffmpeg build a video with a quality close to the original file. I presume that filter_complex forces a new video encode.