Situation
I have accidentally overwrote .mkv file and luckily restored it by using PhotoRec.
Now I have a large size (4.9GB, about 1 hour) file named "f1.mkv" but cannot play it.
To be precise, only about the first second of the video is played, after which the screen remains still and only the current time on the timeline continues to advance.
If I try to jump ahead a few minutes, I get a dialog box that says "Output stream cannot be retrieved".
I'm using ubuntu20.04 desktop and its default media player.
What I have tried
Play it using VLC -> Same result as above
ffmpeg -i f1.mkv -> No error, showing apparently correct information as below:
Input #0, matroska,webm, from 'f1.mkv':
Metadata:
ENCODER : Lavf58.29.100
Duration: 00:56:20.67, start: 0.000000, bitrate: 12264 kb/s
Stream #0:0: Video: h264 (Constrained Baseline), yuv420p(tv, bt709, progressive), 1920x1080, 30 fps, 30 tbr, 1k tbn, 2k tbc (default)
Metadata:
DURATION : 00:56:20.666000000
Stream #0:1: Audio: aac (LC), 48000 Hz, stereo, fltp (default)
Metadata:
title : Track1
DURATION : 00:56:20.672000000
Stream #0:2: Audio: aac (LC), 48000 Hz, stereo, fltp (default)
Metadata:
title : Track2
DURATION : 00:56:20.650000000
ffmpeg -i f1.mkv f1.mp4 -> Huge amount of errors as below
[h264 # 0x55d7ff486440] Invalid NAL unit 0, skipping.
Last message repeated 77 times
[matroska,webm # 0x55d7ff42d6c0] Length 5 indicated by an EBML number's first byte 0x0a at pos 2105851 (0x2021fb) exceeds max length 4.
[h264 # 0x55d7ff486440] Invalid NAL unit 0, skipping.
Last message repeated 22 times
[h264 # 0x55d7ff486440] negative number of zero coeffs at 108 45
[h264 # 0x55d7ff486440] error while decoding MB 108 45
[h264 # 0x55d7ff486440] data partitioning is not implemented. Update your FFmpeg version to the newest one from Git. If the problem still occurs, it means that your file has a feature which has not been implemented.
[h264 # 0x55d7ff486440] If you want to help, upload a sample of this file to ftp://upload.ffmpeg.org/incoming/ and contact the ffmpeg-devel mailing list. (ffmpeg-devel#ffmpeg.org)
[h264 # 0x55d7ff486440] non-existing PPS 5 referenced
[h264 # 0x55d7ff486440] decode_slice_header error
[h264 # 0x55d7ff486440] Frame num change from 4 to 22
[h264 # 0x55d7ff486440] decode_slice_header error
[h264 # 0x55d7ff486440] Frame num change from 4 to 22
[h264 # 0x55d7ff486440] decode_slice_header error
...
[matroska,webm # 0x55d7ff42d6c0] 0x00 at pos 429923807 (0x19a01ddf) invalid as first byte of an EBML number
frame= 153 fps= 17 q=29.0 size= 1024kB time=00:00:05.52 bitrate=1518.2kbits/s dup=60 drop=0 speed=0.614xf108855296.mkv: corrupt decoded frame in stream 0
More than 1000 frames duplicated
frame=70202 fps=421 q=29.0 size= 92160kB time=00:39:00.22 bitrate= 322.6kbits/s dup=70093 drop=0 speed= 1[h264 # 0x55d7ff5cdb80] out of range intra chroma pred mode
[h264 # 0x55d7ff5cdb80] error while decoding MB 64 42
[h264 # 0x55d7ff5cdb80] concealing 3105 DC, 3105 AC, 3105 MV errors in P frame
[matroska,webm # 0x55d7ff42d6c0] Element at 0x9f1f763c ending at 0xa0cc7e77 exceeds containing master element ending at 0x9f24b2cb
frame=70328 fps=393 q=29.0 size= 92160kB time=00:39:04.34 bitrate= 322.0kbits/s dup=70093 drop=123 speed=1f108855296.mkv: corrupt decoded frame in stream 0
frame=70334 fps=393 q=-1.0 Lsize= 93350kB time=00:39:04.38 bitrate= 326.2kbits/s dup=70093 drop=130 speed=13.1x
video:92446kB audio:74kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.896887%
[libx264 # 0x55d7ff4560c0] frame I:283 Avg QP:14.61 size:305979
[libx264 # 0x55d7ff4560c0] frame P:17727 Avg QP:15.49 size: 214
[libx264 # 0x55d7ff4560c0] frame B:52324 Avg QP:21.34 size: 82
[libx264 # 0x55d7ff4560c0] consecutive B-frames: 0.8% 0.0% 0.0% 99.2%
[libx264 # 0x55d7ff4560c0] mb I I16..4: 8.0% 48.9% 43.2%
[libx264 # 0x55d7ff4560c0] mb P I16..4: 0.0% 0.0% 0.0% P16..4: 0.3% 0.0% 0.0% 0.0% 0.0% skip:99.6%
[libx264 # 0x55d7ff4560c0] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 0.2% 0.0% 0.0% direct: 0.0% skip:99.8% L0:24.6% L1:75.1% BI: 0.3%
[libx264 # 0x55d7ff4560c0] 8x8 transform intra:48.9% inter:55.1%
[libx264 # 0x55d7ff4560c0] coded y,uvDC,uvAC intra: 86.3% 73.0% 64.4% inter: 0.0% 0.1% 0.0%
[libx264 # 0x55d7ff4560c0] i16 v,h,dc,p: 33% 53% 10% 3%
[libx264 # 0x55d7ff4560c0] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 12% 21% 15% 7% 9% 6% 10% 7% 13%
[libx264 # 0x55d7ff4560c0] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 22% 30% 9% 5% 7% 6% 8% 5% 9%
[libx264 # 0x55d7ff4560c0] i8c dc,h,v,p: 47% 34% 12% 6%
[libx264 # 0x55d7ff4560c0] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x55d7ff4560c0] ref P L0: 88.0% 3.6% 6.7% 1.7%
[libx264 # 0x55d7ff4560c0] ref B L0: 74.5% 24.6% 0.8%
[libx264 # 0x55d7ff4560c0] ref B L1: 98.8% 1.2%
[libx264 # 0x55d7ff4560c0] kb/s:323.02
[aac # 0x55d7ff459440] Qavg: 29327.965
Now I can see f1.mp4 for few more seconds with stuttering screen.
Is there I can do more?
Related
when doing an streaming with FFMPEG all works perfectly until I get these messages and then, ffmpeg.exe exits:
av_interleaved_write_frame(): Unknown error
frame= 1224 fps=3.4 q=13.0 size= 2758kB time=00:01:21.94 bitrate= 275.8kbits/s speed=0.226x
av_interleaved_write_frame(): Unknown error
[flv # 000001e310e8a1c0] Failed to update header with correct duration.
[flv # 000001e310e8a1c0] Failed to update header with correct filesize.
Error writing trailer of rtmp://example.com/s/2b32abdc-130c-43e5-997e-079e69d1fd7f: Error number -10053 occurred
frame= 1224 fps=3.4 q=13.0 Lsize= 2758kB time=00:01:21.98 bitrate= 275.6kbits/s speed=0.226x
video:2481kB audio:221kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 2.084671%
[libx264 # 000001e310ad6080] frame I:41 Avg QP:10.29 size: 57664
[libx264 # 000001e310ad6080] frame P:1183 Avg QP:13.52 size: 148
[libx264 # 000001e310ad6080] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 # 000001e310ad6080] mb P I16..4: 0.1% 0.0% 0.0% P16..4: 0.2% 0.0% 0.0% 0.0% 0.0% skip:99.7%
[libx264 # 000001e310ad6080] coded y,uvDC,uvAC intra: 10.9% 7.1% 5.4% inter: 0.0% 0.1% 0.0%
[libx264 # 000001e310ad6080] i16 v,h,dc,p: 84% 6% 6% 4%
[libx264 # 000001e310ad6080] i8c dc,h,v,p: 91% 6% 3% 1%
[libx264 # 000001e310ad6080] kb/s:248.98
[aac # 000001e310a46d40] Qavg: 108.454
Conversion failed!
Normally, the messages I received are similar to this:
frame= 1196 fps=3.4 q=13.0 size= 2692kB time=00:01:20.08 bitrate= 275.4kbits/s speed=0.227x
Which are the expected messages. Sometimes, I received this message, but this does not cause ffmpeg.exe to exit:
Input #0, matroska,webm, from 'pipe:':
Metadata:
encoder : Chrome
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0(eng): Audio: opus, 48000 Hz, mono, fltp (default)
Stream #0:1(eng): Video: h264 (Constrained Baseline), yuv420p(progressive), 1920x1080, SAR 1:1 DAR 16:9, 30.30 fps, 14.99 tbr, 1k tbn, 60 tbc (default)
What may be happening? maybe it is a problem of the RTMP server? or something is wrong with FFMPEG?
This version of FFMPEG.EXE is for windows. The programming language is C# from where I am launching FFMPEG.EXE process.
As I told, this happens after several frames sent to the server. Only once, this problem occured after a few frames sent. That is why I suspect that the RTMP server is the problem.
EDIT: This is the command:
FFMPEG -i - -c:v libx264 -preset ultrafast -tune zerolatency -max_muxing_queue_size 1000 -bufsize 5000 -r 15 -g 30 -keyint_min 30 -x264opts keyint=30 -crf 25 -pix_fmt yuv420p -profile:v baseline -level 3 -c:a aac -b:a 22k -ar 22050 -f flv rtmp://rtmp.xxxx.yyyy
Regards
Jaime
I am trying to convert a set of jpg files to a slideshow with varying durations using ffconcat
output.txt contents:
ffconcat version 1.0
file slide_0001.jpg
duration 0.163
file slide_0002.jpg
duration 0.533
file slide_0003.jpg
duration 1.067
file slide_0004.jpg
duration 0.533
file slide_0005.jpg
etc.
FFmpeg command:
ffmpeg -i output.txt output.mkv
I also tried:
ffmpeg -i output.txt -c:v copy output.mkv
However, when converting, the colours of the images become skewed.
White becomes pink / purple and dark green becomes light green.
The same happens when choosing different codecs and containers.
Is there a way to solve this?
EDIT:
I performed the same conversion again. I attached the log output as requested.
However, in the meantime I have figured out that converting without ffconcat duration and then altering timecodes with mp4fpsmod is more efficient in terms of storage (3 vs 40 MB) and gives less issues in different players. The result is nonetheless the same: colours are still wrong, both on my workstation (Ubuntu 18.04) and laptop (macOS Mojave).
I tried to alter things with pix_fmt and -vf format as can be seen in the second log output. This did not solve the problem.
Background info:
The input jpg files are from a lecture recording made with MediaSite, which has both a video stream for the room as well as this slideshow stream for the slides.
Example of input:
Example of output:
log output MKV conversion:
$ ffmpeg -i outputnew.txt output12345.mkv
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-opencl --enable-videotoolbox
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, concat, from 'outputnew.txt':
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 1280x720, 25 tbr, 25 tbn, 25 tbc
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[libx264 # 0x7fb284802800] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 0x7fb284802800] profile High 4:4:4 Predictive, level 3.1, 4:4:4 8-bit
[libx264 # 0x7fb284802800] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=3 deblock=1:0:0 analyse=0x1:0x111 me=hex subme=7 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=0 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=4 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1 b_bias=0 direct=1 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=40 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, matroska, to 'output12345.mkv':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: h264 (libx264) (H264 / 0x34363248), yuvj444p(pc), 1280x720, q=-1--1, 25 fps, 1k tbn, 25 tbc
Metadata:
encoder : Lavc58.35.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
[mjpeg # 0x7fb284061200] EOI missing, emulating=00:02:12.96 bitrate= 491.3kbits/s speed=14.3x
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 487.2kbits/s speed=14.3x
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 333.0kbits/s speed=22.3x
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 338.8kbits/s speed=22.7x
Last message repeated 2 times
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 164.7kbits/s speed=41.6x
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 122.7kbits/s speed=55.7x
Last message repeated 1 times
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 111.2kbits/s speed=60.5x
Last message repeated 1 times
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 105.3kbits/s speed=64.4x
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 82.2kbits/s speed=82.7x
Last message repeated 1 times
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 79.7kbits/s speed=85.8x
Last message repeated 2 times
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 59.7kbits/s speed= 114x
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 53.8kbits/s speed= 127x
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 54.7kbits/s speed= 124x
Last message repeated 1 times
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 47.1kbits/s speed= 143x
Last message repeated 1 times
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 47.0kbits/s speed= 144x
Last message repeated 1 times
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 44.6kbits/s speed= 151x
Last message repeated 1 times
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 34.4kbits/s speed= 194x
Last message repeated 2 times
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 32.9kbits/s speed= 204x
Last message repeated 2 times
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 32.8kbits/s speed= 203x
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 32.6kbits/s speed= 202x
Last message repeated 1 times
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 28.8kbits/s speed= 229x
Last message repeated 2 times
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 27.9kbits/s speed= 236x
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 27.9kbits/s speed= 233x
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 23.9kbits/s speed= 274x
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 24.2kbits/s speed= 273x
Last message repeated 2 times
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 24.2kbits/s speed= 274x
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 24.0kbits/s speed= 276x
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 24.2kbits/s speed= 273x
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 23.6kbits/s speed= 278x
Last message repeated 1 times
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 23.7kbits/s speed= 279x
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 23.6kbits/s speed= 279x
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 24.0kbits/s speed= 276x
Last message repeated 1 times
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 23.5kbits/s speed= 281x
Last message repeated 1 times
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 20.4kbits/s speed= 325x
[mjpeg # 0x7fb28502a000] EOI missing, emulating
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 20.1kbits/s speed= 329x
Last message repeated 1 times
[matroska # 0x7fb284812e00] Starting new cluster due to timestampte= 20.1kbits/s speed= 330x
frame= 635 fps= 14 q=-1.0 Lsize= 37389kB time=04:22:06.76 bitrate= 19.5kbits/s speed= 343x
video:37378kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.029620%
[libx264 # 0x7fb284802800] frame I:16 Avg QP:11.98 size:154224
[libx264 # 0x7fb284802800] frame P:184 Avg QP:13.30 size: 79029
[libx264 # 0x7fb284802800] frame B:435 Avg QP:13.19 size: 48887
[libx264 # 0x7fb284802800] consecutive B-frames: 6.0% 4.4% 10.9% 78.7%
[libx264 # 0x7fb284802800] mb I I16..4: 55.7% 0.0% 44.3%
[libx264 # 0x7fb284802800] mb P I16..4: 32.4% 0.0% 21.5% P16..4: 13.3% 15.1% 11.3% 0.0% 0.0% skip: 6.4%
[libx264 # 0x7fb284802800] mb B I16..4: 17.8% 0.0% 7.2% B16..8: 19.1% 19.4% 6.5% direct:14.6% skip:15.3% L0:47.0% L1:38.9% BI:14.1%
[libx264 # 0x7fb284802800] coded y,u,v intra: 63.7% 26.1% 56.3% inter: 46.5% 24.6% 43.5%
[libx264 # 0x7fb284802800] i16 v,h,dc,p: 19% 18% 58% 4%
[libx264 # 0x7fb284802800] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 35% 20% 25% 4% 4% 3% 3% 3% 3%
[libx264 # 0x7fb284802800] Weighted P-Frames: Y:5.4% UV:5.4%
[libx264 # 0x7fb284802800] ref P L0: 43.2% 4.4% 30.8% 21.4% 0.2%
[libx264 # 0x7fb284802800] ref B L0: 64.1% 27.3% 8.6%
[libx264 # 0x7fb284802800] ref B L1: 85.3% 14.7%
[libx264 # 0x7fb284802800] kb/s:19.25
Log output mp4 conversion:
$ ffmpeg -i slide_%04d.jpg -vf format=rgba -pix_fmt yuv420p -vcodec libx264 -movflags +faststart -preset veryslow output12345.mp4
ffmpeg version 4.1 Copyright (c) 2000-2018 the FFmpeg developers
built with Apple LLVM version 10.0.0 (clang-1000.11.45.5)
configuration: --prefix=/usr/local/Cellar/ffmpeg/4.1 --enable-shared --enable-pthreads --enable-version3 --enable-hardcoded-tables --enable-avresample --cc=clang --host-cflags= --host-ldflags= --enable-ffplay --enable-gpl --enable-libmp3lame --enable-libopus --enable-libsnappy --enable-libtheora --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-libxvid --enable-lzma --enable-opencl --enable-videotoolbox
libavutil 56. 22.100 / 56. 22.100
libavcodec 58. 35.100 / 58. 35.100
libavformat 58. 20.100 / 58. 20.100
libavdevice 58. 5.100 / 58. 5.100
libavfilter 7. 40.101 / 7. 40.101
libavresample 4. 0. 0 / 4. 0. 0
libswscale 5. 3.100 / 5. 3.100
libswresample 3. 3.100 / 3. 3.100
libpostproc 55. 3.100 / 55. 3.100
Input #0, image2, from 'slide_%04d.jpg':
Duration: 00:00:25.36, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg, yuvj444p(pc, bt470bg/unknown/unknown), 1280x720, 25 fps, 25 tbr, 25 tbn, 25 tbc
File 'output12345.mp4' already exists. Overwrite ? [y/N] y
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Press [q] to stop, [?] for help
[swscaler # 0x7fb7e280b000] deprecated pixel format used, make sure you did set range correctly
[libx264 # 0x7fb7e1803c00] using cpu capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2
[libx264 # 0x7fb7e1803c00] profile High, level 5.0
[libx264 # 0x7fb7e1803c00] 264 - core 152 r2854 e9a5903 - H.264/MPEG-4 AVC codec - Copyleft 2003-2017 - http://www.videolan.org/x264.html - options: cabac=1 ref=16 deblock=1:0:0 analyse=0x3:0x133 me=umh subme=10 psy=1 psy_rd=1.00:0.00 mixed_ref=1 me_range=24 chroma_me=1 trellis=2 8x8dct=1 cqm=0 deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=6 lookahead_threads=1 sliced_threads=0 nr=0 decimate=1 interlaced=0 bluray_compat=0 constrained_intra=0 bframes=8 b_pyramid=2 b_adapt=2 b_bias=0 direct=3 weightb=1 open_gop=0 weightp=2 keyint=250 keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=60 rc=crf mbtree=1 crf=23.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40 aq=1:1.00
Output #0, mp4, to 'output12345.mp4':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1280x720, q=-1--1, 25 fps, 12800 tbn, 25 tbc
Metadata:
encoder : Lavc58.35.100 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
[mp4 # 0x7fb7e1801800] Starting second pass: moving the moov atom to the beginning of the file
frame= 634 fps=8.5 q=-1.0 Lsize= 2252kB time=00:00:25.24 bitrate= 731.0kbits/s speed=0.337x
video:2245kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.307448%
[libx264 # 0x7fb7e1803c00] frame I:5 Avg QP:19.12 size: 49393
[libx264 # 0x7fb7e1803c00] frame P:131 Avg QP:22.18 size: 9379
[libx264 # 0x7fb7e1803c00] frame B:498 Avg QP:23.78 size: 1652
[libx264 # 0x7fb7e1803c00] consecutive B-frames: 3.2% 1.6% 3.3% 29.7% 7.9% 16.1% 7.7% 16.4% 14.2%
[libx264 # 0x7fb7e1803c00] mb I I16..4: 45.7% 37.9% 16.4%
[libx264 # 0x7fb7e1803c00] mb P I16..4: 6.0% 5.3% 1.3% P16..4: 19.9% 1.9% 3.7% 0.3% 0.1% skip:61.5%
[libx264 # 0x7fb7e1803c00] mb B I16..4: 0.3% 0.4% 0.1% B16..8: 17.5% 1.0% 0.2% direct: 0.3% skip:80.2% L0:52.3% L1:46.9% BI: 0.8%
[libx264 # 0x7fb7e1803c00] 8x8 transform intra:43.0% inter:48.9%
[libx264 # 0x7fb7e1803c00] direct mvs spatial:99.2% temporal:0.8%
[libx264 # 0x7fb7e1803c00] coded y,uvDC,uvAC intra: 16.9% 25.8% 16.6% inter: 1.1% 1.9% 1.2%
[libx264 # 0x7fb7e1803c00] i16 v,h,dc,p: 61% 28% 6% 6%
[libx264 # 0x7fb7e1803c00] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 20% 9% 50% 3% 4% 3% 3% 3% 5%
[libx264 # 0x7fb7e1803c00] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 18% 23% 19% 5% 7% 6% 6% 5% 10%
[libx264 # 0x7fb7e1803c00] i8c dc,h,v,p: 46% 40% 13% 1%
[libx264 # 0x7fb7e1803c00] Weighted P-Frames: Y:5.3% UV:5.3%
[libx264 # 0x7fb7e1803c00] ref P L0: 33.2% 3.1% 11.6% 7.3% 8.8% 6.4% 6.5% 3.1% 3.2% 2.6% 2.4% 2.5% 2.8% 2.8% 2.3% 1.4%
[libx264 # 0x7fb7e1803c00] ref B L0: 42.0% 15.1% 12.0% 5.4% 4.9% 4.3% 4.0% 1.9% 2.0% 1.8% 1.7% 1.8% 1.7% 1.1% 0.5%
[libx264 # 0x7fb7e1803c00] ref B L1: 83.5% 16.5%
[libx264 # 0x7fb7e1803c00] kb/s:725.10
Player:
QuickTime, VLC and Kodi on both Linux and Mac.
EDIT 2:
Input files: https://drive.google.com/open?id=1kbBkSDSwe6ywgQ8lkjqkh-MKCzGA4bj8
I think you need to delete the first line and add quote marks in your text file:
file 'slide_0001.jpg'
duration 0.163
file 'slide_0002.jpg'
duration 0.533
file 'slide_0003.jpg'
duration 1.067
file 'slide_0004.jpg'
duration 0.533
file 'slide_0005.jpg'
etc.
The command should be:
ffmpeg -f concat -i png.txt -vf fps=25 output.mp4
I've tested this and it works.
This was bug #7625. It was fixed on 2018-12-18:
lavc/mjpegdec: Interpret three-component Adobe transform 0 also as RGB
Download a recent build from the git master branch and the fix will be included. For old versions a workaround proposed by Gyan in the bug report comments is to use a filter: mergeplanes=0x010200:format=gbrp.
After spending almost half a day on this, I have managed to find a (not so pretty) solution to my problem:
Step 1
cd to folder with slides.
Convert images from .jpg to .png using ImageMagick to prevent colour problems
mogrify -format png *.jpg
Step 2
Convert and put .png images into mp4 file using FFmpeg
ffmpeg -i slide_%04d.png -c:v libx264 -vf mergeplanes=0x010200:format=gbrp -pix_fmt yuv420p -preset veryslow output.mp4
Step 3
Using mp4fpsmod, alter the timecode of the newly created file
mp4fpsmod -t timecode.txt output.mp4 -o timedoutput.mp4
Example of timecode.txt
# timecode format v2
163
696
1763
2296
2829
3363
The resulting file has a size of around 5 MB, whereas the original .jpg files have a size of 122 MB, which is great.
Remaining problems
The file plays well in QuickTime, but unfortunately not in VLC.
I will create a new question for this, because I need VLC to play this file together with an mp4 video and be able to scroll through the videos simultaneously.
However, if you read this and know the answer, please do not hesitate to comment here.
EDIT: Incorporated changes as suggested by user llogan solving the colour issues.
So, I'm using this code to compress my *mp4 file. I need to get lower quality and decrease bitrate:
ffmpeg -i input.mp4 -c:v libx264 output.mp4
The problem is: the last frame of footage is dropped after ffmpeg compression.
Screenshot is here: screenshot_ffmpeg_drop frame
I tried to use full preferences I need, but the problem is the same.
ffmpeg -i input.mp4 -c:v libx264 -vf scale=1280:720 -preset fast -crf 29 -r 25 -c:a copy output.mp4
logfile during ffmpeg encoding:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '\input.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
creation_time : 2018-10-28T11:06:03.000000Z
Duration: 00:00:12.76, start: 0.000000, bitrate: 5374 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080 [SAR 1:1 DAR 16:9], 5368 kb/s, 25 fps, 25 tbr, 50k tbn, 50 tbc (default)
Metadata:
creation_time : 2018-10-28T11:06:03.000000Z
handler_name : Alias Data Handler
encoder : AVC Coding
Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> h264
(libx264)) Press [q] to stop, [?] for help [libx264 #
000002fae8b50780] using SAR=1/1 [libx264 # 000002fae8b50780] using cpu
capabilities: MMX2 SSE2Fast SSSE3 SSE4.2 AVX FMA3 BMI2 AVX2 [libx264 #
000002fae8b50780] profile High, level 3.1 [libx264 # 000002fae8b50780]
264 - core 155 r2901 7d0ff22 - H.264/MPEG-4 AVC codec - Copyleft
2003-2018 - http://www.videolan.org/x264.html - options: cabac=1 ref=2
deblock=1:0:0 analyse=0x3:0x113 me=hex subme=6 psy=1 psy_rd=1.00:0.00
mixed_ref=1 me_range=16 chroma_me=1 trellis=1 8x8dct=1 cqm=0
deadzone=21,11 fast_pskip=1 chroma_qp_offset=-2 threads=12
lookahead_threads=2 sliced_threads=0 nr=0 decimate=1 interlaced=0
bluray_compat=0 constrained_intra=0 bframes=3 b_pyramid=2 b_adapt=1
b_bias=0 direct=1 weightb=1 open_gop=0 weightp=1 keyint=250
keyint_min=25 scenecut=40 intra_refresh=0 rc_lookahead=30 rc=crf
mbtree=1 crf=29.0 qcomp=0.60 qpmin=0 qpmax=69 qpstep=4 ip_ratio=1.40
aq=1:1.00 Output #0, mp4, to '\output.mp4': Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: mp42mp41
encoder : Lavf58.17.100
Stream #0:0(eng): Video: h264 (libx264) (avc1 / 0x31637661), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], q=-1--1, 25 fps, 12800 tbn, 25
tbc (default)
Metadata:
creation_time : 2018-10-28T11:06:03.000000Z
handler_name : Alias Data Handler
encoder : Lavc58.19.104 libx264
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 318 fps=127 q=-1.0 Lsize= 855kB time=00:00:12.60 bitrate=
556.0kbits/s speed=5.05x video:851kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.534683% [libx264 #
0000015d5cef0500] frame I:2 Avg QP:26.18 size: 67800 [libx264 #
0000015d5cef0500] frame P:80 Avg QP:27.93 size: 5439 [libx264 #
0000015d5cef0500] frame B:236 Avg QP:32.44 size: 1269 [libx264 #
0000015d5cef0500] consecutive B-frames: 0.9% 0.0% 0.9% 98.1%
[libx264 # 0000015d5cef0500] mb I I16..4: 10.6% 62.5% 26.8% [libx264
# 0000015d5cef0500] mb P I16..4: 0.5% 1.0% 0.2% P16..4: 36.1%
5.1% 3.6% 0.0% 0.0% skip:53.6% [libx264 # 0000015d5cef0500] mb B I16..4: 0.6% 0.5% 0.0% B16..8: 22.2% 0.6% 0.0% direct: 2.0%
skip:74.2% L0:44.9% L1:54.5% BI: 0.6% [libx264 # 0000015d5cef0500]
8x8 transform intra:55.0% inter:86.2% [libx264 # 0000015d5cef0500]
coded y,uvDC,uvAC intra: 48.1% 54.9% 27.0% inter: 3.2% 5.2% 0.2%
[libx264 # 0000015d5cef0500] i16 v,h,dc,p: 19% 56% 10% 15% [libx264 #
0000015d5cef0500] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 19% 25% 18% 5% 6%
5% 8% 5% 8% [libx264 # 0000015d5cef0500] i4
v,h,dc,ddl,ddr,vr,hd,vl,hu: 27% 24% 9% 5% 8% 7% 9% 5% 7%
[libx264 # 0000015d5cef0500] i8c dc,h,v,p: 60% 20% 15% 4% [libx264 #
0000015d5cef0500] Weighted P-Frames: Y:0.0% UV:0.0% [libx264 #
0000015d5cef0500] ref P L0: 67.7% 32.3% [libx264 # 0000015d5cef0500]
ref B L0: 80.4% 19.6% [libx264 # 0000015d5cef0500] ref B L1: 92.1%
7.9% [libx264 # 0000015d5cef0500] kb/s:547.35
Use
ffmpeg -ignore_editlist 1 -i input.mp4 ... output.mp4
I am trying to convert a yuv file to mp4 using:
ffmpeg -f rawvideo -vcodec rawvideo -s 1920x1080 -r 25 -pix_fmt yuv420p -i inputfile.yuv -c:v libx264 -preset ultrafast -qp 0 output.mp4
but i am getting following error:
[rawvideo # 0000023f70bf8d20] Invalid buffer size, packet size 2649600 < expected frame_size 3110400
Error while decoding stream #0:0: Invalid argument
frame= 251 fps= 22 q=-1.0 Lsize= 373766kB time=00:00:10.00 bitrate=306186.8kbits/s speed=0.861x
video:373763kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000738%
[libx264 # 0000023f70bfaae0] frame I:2 Avg QP: 0.00 size:1412854
[libx264 # 0000023f70bfaae0] frame P:249 Avg QP: 0.00 size:1525733
[libx264 # 0000023f70bfaae0] mb I I16..4: 100.0% 0.0% 0.0%
[libx264 # 0000023f70bfaae0] mb P I16..4: 57.0% 0.0% 0.0% P16..4: 43.0% 0.0% 0.0% 0.0% 0.0% skip: 0.0%
[libx264 # 0000023f70bfaae0] coded y,uvDC,uvAC intra: 100.0% 100.0% 100.0% inter: 100.0% 100.0% 100.0%
[libx264 # 0000023f70bfaae0] i16 v,h,dc,p: 45% 52% 3% 0%
[libx264 # 0000023f70bfaae0] i8c dc,h,v,p: 1% 90% 9% 0%
[libx264 # 0000023f70bfaae0] kb/s:304966.66
Goal is to create stream for facebook from image and audio file.
This is my command:
ffmpeg \
-re -y \
-loop 1 \
-f image2 \
-i ./maxresdefault.jpg \
-i ./audio-loop.mp3 \
-ar 44100 \
-b:a 128k \
-vcodec libx264 \
-vf scale=800:600 \
-b:v 1000k -minrate 1000k -maxrate 1000k -bufsize 500k \
-f flv 'rtmp://rtmp-api.facebook.com:80/rtmp/...'
I get error like:
Stream mapping:
Stream #0:0 -> #0:0 (mjpeg (native) -> h264 (libx264))
Stream #1:0 -> #0:1 (mp3 (native) -> mp3 (libmp3lame))
Press [q] to stop, [?] for help
[flv # 0x1637d00] Packets are not in the proper order with respect to DTSkbits/s
av_interleaved_write_frame(): Invalid argument <<< --------
[flv # 0x1637d00] Failed to update header with correct duration.
[flv # 0x1637d00] Failed to update header with correct filesize.
frame= 57 fps= 22 q=-1.0 Lsize= 1325kB time=00:01:21.60 bitrate= 133.0kbits/s
video:26kB audio:1276kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.749549%
[libx264 # 0x1644760] frame I:1 Avg QP:17.89 size: 26318
[libx264 # 0x1644760] frame P:14 Avg QP:10.39 size: 7242
[libx264 # 0x1644760] frame B:42 Avg QP:13.38 size: 118
[libx264 # 0x1644760] consecutive B-frames: 1.8% 0.0% 0.0% 98.2%
[libx264 # 0x1644760] mb I I16..4: 6.7% 61.2% 32.1%
[libx264 # 0x1644760] mb P I16..4: 0.2% 0.1% 0.3% P16..4: 29.3% 2.3% 4.9% 0.0% 0.0% skip:62.9%
[libx264 # 0x1644760] mb B I16..4: 0.0% 0.0% 0.0% B16..8: 8.3% 0.0% 0.0% direct: 0.0% skip:91.7% L0: 5.1% L1:94.9% BI: 0.0%
[libx264 # 0x1644760] 8x8 transform intra:58.0% inter:41.3%
[libx264 # 0x1644760] coded y,uvDC,uvAC intra: 69.4% 65.4% 52.4% inter: 4.5% 4.2% 2.9%
[libx264 # 0x1644760] i16 v,h,dc,p: 13% 57% 11% 18%
[libx264 # 0x1644760] i8 v,h,dc,ddl,ddr,vr,hd,vl,hu: 25% 27% 10% 4% 6% 7% 7% 6% 8%
[libx264 # 0x1644760] i4 v,h,dc,ddl,ddr,vr,hd,vl,hu: 40% 28% 9% 3% 5% 4% 4% 3% 3%
[libx264 # 0x1644760] i8c dc,h,v,p: 58% 24% 16% 3%
[libx264 # 0x1644760] Weighted P-Frames: Y:0.0% UV:0.0%
[libx264 # 0x1644760] ref P L0: 93.5% 0.6% 4.8% 1.1%
[libx264 # 0x1644760] ref B L0: 69.3% 29.3% 1.5%
[libx264 # 0x1644760] ref B L1: 95.5% 4.5%
[libx264 # 0x1644760] kb/s:465.47
Conversion failed!
I've been searching for about 4 hours. I believe it's something to do with Sound.
I was having the same problem, ended up switching my audio encoding to libvo_aacenc instead of libmp3lame...
I have not tested if the audio still works however the stream is no longer dying.