Input #0, video4linux2,v4l2, from '/dev/video0':
Duration: N/A, start: 13555.753906, bitrate: 147456 kb/s
Stream #0:0: Video: rawvideo (YUY2 / 0x32595559), yuyv422, 640x480, 147456 kb/s, 30 fps, 30 tbr, 1000k tbn, 1000k tbc
Stream mapping:
Stream #0:0 -> #0:0 (rawvideo (native) -> mjpeg (native))
Press [q] to stop, [?] for help
[swscaler # 0x55fd0eafa3e0] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'test1.jpeg':
Metadata:
encoder : Lavf57.83.100
Stream #0:0: Video: mjpeg, yuvj422p(pc), 640x480, q=2-31, 200 kb/s, 30 fps, 30 tbn, 30 tbc
Metadata:
encoder : Lavc57.107.100 mjpeg
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
frame= 1 fps=0.0 q=1.6 Lsize=N/A time=00:00:00.03 bitrate=N/A speed=8.41x
video:3kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Related
I would like to keep only upper half of the image in a video. How to do that? The original video is 2048x2048 pixels. I would like a 2048x1024 resolution video with the upper half of the original.
If I enter the following:
ffmpeg -y -i in.avi -vf v360=fisheye:equirect:ih_fov=180:iv_fov=180,transpose=1,crop=in_w:in_h/2:0:0 -c:a copy out.avi
then I get a 2048x2048 video where the upper half is black and the bottom is correct (it is the upper half of the original)...
The original video is from a 180 degree camera. If I omit the crop part from the video filter, then I get the desired perspective, but bottom half of the image is not needed...
Log:
Input #0, avi, from 'in.avi': Metadata:
encoder : Lavf55.48.100 Duration: 00:00:11.00, start: 0.000000, bitrate: 3821 kb/s
Stream #0:0: Video: h264 (Main) (H264 / 0x34363248), yuvj420p(pc, bt709, progressive), 2048x2048, 3828 kb/s, 20 fps, 20 tbr, 20 tbn, 40 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 8000 Hz, mono, s16, 128 kb/s Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> mpeg4 (native)) Stream #0:1 -> #0:1 (copy) Press [q] to stop, [?] for help [swscaler # 0000027b3e1d5a40] deprecated pixel format used, make sure you did set range correctly Output #0, avi, to 'out.avi': Metadata:
ISFT : Lavf58.49.100
Stream #0:0: Video: mpeg4 (FMP4 / 0x34504D46), yuv420p, 2048x2048, q=2-31, 200 kb/s, 20 fps, 20 tbn, 20 tbc
Metadata:
encoder : Lavc58.99.100 mpeg4
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: N/A
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 8000 Hz, mono, s16, 128 kb/s frame= 220 fps= 32 q=31.0 Lsize= 2368kB time=00:00:11.00 bitrate=1763.8kbits/s speed= 1.6x video:2353kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.634127%
OOops, I think I have found the reason: the v360 filter makes a 4096x2048 video from the 2048x2048 pixel original.
ffmpeg -i instagram.mp4 -vf fps=29.97 thumb%06d.jpg -hide_banner
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'instagram.mp4': Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf55.19.104 Duration: 00:00:13.61, start: 0.000000, bitrate: 1163 kb/s
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 640x640 [SAR 1:1 DAR 1:1], 1099 kb/s, 29.97 fps,
29.97 tbr, 11988 tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 64 kb/s (default)
Metadata:
handler_name : SoundHandler Stream mapping: Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native)) Press [q] to stop, [?] for help [swscaler # 0x55b2b53cf440] deprecated pixel format used, make sure
you did set range correctly Output #0, image2, to 'thumb%06d.jpg':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf57.83.100
Stream #0:0(und): Video: mjpeg, yuvj420p(pc), 640x640 [SAR 1:1 DAR 1:1], q=2-31, 200 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc (default)
Metadata:
handler_name : VideoHandler
encoder : Lavc57.107.100 mjpeg
Side data:
cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1 frame= 405 fps=231 q=24.8 Lsize=N/A time=00:00:13.51 bitrate=N/A speed=7.72x video:5961kB audio:0kB subtitle:0kB other streams:0kB
global headers:0kB muxing overhead: unknown
The video duration is 13.61 seconds and frame rate is 29.97. So I was expecting 13.61 * 29.97 = 407.8917 i.e. 407 frames. But have got 405 frames. I am new to ffmpeg, need help to correctly get all 407 frames.
I had also tried following command,
ffmpeg -i instagram.mp4 thumb%06d.jpg -hide_banner
but the output was same 405 frames.
Possibly the start 2 frames are missing.
I need to display the frames generated in the base video timeline. And on clicking on the frame I need to exactly seek the video to the frame position using HTML5 currentTime. Since the first 2 frames are not getting available, exact mapping is not getting possible.
Please guide.
have you try to use -vsync vfr or -vsync 0 disables the frame drop/dup behaviour?
#Gyan
Please refer to this question.
https://superuser.com/questions/1374584/why-does-ffmpeg-extracts-a-lot-more-frames-than-the-actual
ffmpeg's ssim instructions say the reference should go second, and when I compare these videos in that order, (where 'copy.avi' should be lossless H.264 copy of 'original.avi') SSIM and PSNR return lossless results. But if I reverse the order the performance isn't lossless.
Why is this happening?
Copy first, original second
> ffmpeg -hide_banner -i copy.avi -i original.avi -lavfi "ssim;[0:v][1:v]psnr" -f null –
[avi # 0x7ffdee002000] decoding for stream 0 failed
Input #0, avi, from 'copy.avi':
Metadata:
encoder : Lavf58.20.100
Duration: 00:00:10.67, start: 0.000000, bitrate: 644937 kb/s
Stream #0:0: Video: h264 (High 4:4:4 Predictive) (H264 / 0x34363248), yuv420p(progressive), 2048x1536, 645930 kb/s, 60 fps, 60 tbr, 60 tbn, 120 tbc
Input #1, avi, from 'original.avi':
Metadata:
encoder : Lavf54.35.100
Duration: 00:00:10.67, start: 0.000000, bitrate: 1509965 kb/s
Stream #1:0: Video: rawvideo (Y800 / 0x30303859), gray, 2048x1536, 1512312 kb/s, 60 fps, 60 tbr, 60 tbn, 60 tbc
Stream mapping:
Stream #0:0 (h264) -> ssim:main
Stream #0:0 (h264) -> psnr:main
Stream #1:0 (rawvideo) -> ssim:reference
Stream #1:0 (rawvideo) -> psnr:reference
ssim -> Stream #0:0 (wrapped_avframe)
psnr -> Stream #0:1 (wrapped_avframe)
Press [q] to stop, [?] for help
Output #0, null, to '–':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: wrapped_avframe, yuv420p(progressive), 2048x1536, q=2-31, 200 kb/s, 60 fps, 60 tbn, 60 tbc
Metadata:
encoder : Lavc58.35.100 wrapped_avframe
Stream #0:1: Video: wrapped_avframe, yuv420p, 2048x1536, q=2-31, 200 kb/s, 60 fps, 60 tbn, 60 tbc
Metadata:
encoder : Lavc58.35.100 wrapped_avframe
frame= 640 fps= 72 q=-0.0 Lq=-0.0 size=N/A time=00:00:10.66 bitrate=N/A speed=1.21x
video:670kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[Parsed_ssim_0 # 0x7ffdef8024c0] SSIM Y:1.000000 (inf) U:1.000000 (inf) V:1.000000 (inf) All:1.000000 (inf)
[Parsed_psnr_1 # 0x7ffdef802940] PSNR y:inf u:inf v:inf average:inf min:inf max:inf
Original first, copy second
> ffmpeg -hide_banner -i original.avi -i copy.avi -lavfi "ssim;[0:v][1:v]psnr" -f null –
Input #0, avi, from 'original.avi':
Metadata:
encoder : Lavf54.35.100
Duration: 00:00:10.67, start: 0.000000, bitrate: 1509965 kb/s
Stream #0:0: Video: rawvideo (Y800 / 0x30303859), gray, 2048x1536, 1512312 kb/s, 60 fps, 60 tbr, 60 tbn, 60 tbc
[avi # 0x7fb74680d600] decoding for stream 0 failed
Input #1, avi, from 'copy.avi':
Metadata:
encoder : Lavf58.20.100
Duration: 00:00:10.67, start: 0.000000, bitrate: 644937 kb/s
Stream #1:0: Video: h264 (High 4:4:4 Predictive) (H264 / 0x34363248), yuv420p(progressive), 2048x1536, 645930 kb/s, 60 fps, 60 tbr, 60 tbn, 120 tbc
Stream mapping:
Stream #0:0 (rawvideo) -> ssim:main
Stream #0:0 (rawvideo) -> psnr:main
Stream #1:0 (h264) -> ssim:reference
Stream #1:0 (h264) -> psnr:reference
ssim -> Stream #0:0 (wrapped_avframe)
psnr -> Stream #0:1 (wrapped_avframe)
Press [q] to stop, [?] for help
Output #0, null, to '–':
Metadata:
encoder : Lavf58.20.100
Stream #0:0: Video: wrapped_avframe, gray(progressive), 2048x1536, q=2-31, 200 kb/s, 60 fps, 60 tbn, 60 tbc
Metadata:
encoder : Lavc58.35.100 wrapped_avframe
Stream #0:1: Video: wrapped_avframe, gray, 2048x1536, q=2-31, 200 kb/s, 60 fps, 60 tbn, 60 tbc
Metadata:
encoder : Lavc58.35.100 wrapped_avframe
frame= 640 fps= 72 q=-0.0 Lq=-0.0 size=N/A time=00:00:10.66 bitrate=N/A speed=1.19x
video:670kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
[Parsed_ssim_0 # 0x7fb748101780] SSIM Y:0.998296 (27.684975) All:0.998296 (27.684975)
[Parsed_psnr_1 # 0x7fb748101c40] PSNR y:56.840774 average:56.840774 min:56.812125 max:56.871584
One format is yuv420p and another is gray. So for comparing them, one either convert gray to yuv420p or yuv420p to gray. As you noticed this operation is not always lossless. To compare only Y plane use extractplanes=y filter before calling psnr/ssim.
Could you help me to find my mistake. I am trying to concatenate two files (webm) which have transparent background. I do the following:
ffmpeg -i 1.webm -i 2.webm -filter_complex "[0:v:0] 1:v:0]concat=n=2:v=1[outv]" -map "[outv]" 3.webm
I get the concatenate video as i I expect. However the transparent background disappears. Instead the background is black. How to keep the transparency when i concatenate two videos?
The output of the above command is:
ffmpeg version 3.3.4-2 Copyright (c) 2000-2017 the FFmpeg developers built with gcc 7 (Ubuntu 7.2.0-8ubuntu2)
Input #0, matroska,webm, from '1.webm':
Metadata:
encoder : Lavf57.71.100
Duration: 00:00:04.35, start: 0.000000, bitrate: 293 kb/s
Stream #0:0(eng): Video: vp9 (Profile 0), yuv420p(tv, progressive), 799x770, SAR 1:1 DAR 799:770, 23 fps, 23 tbr, 1k tbn, 1k tbc (default)
Metadata:
alpha_mode : 1
Input #1, matroska,webm, from '2.webm':
Metadata:
encoder : Lavf57.71.100
Duration: 00:00:04.35, start: 0.000000, bitrate: 303 kb/s
Stream #1:0(eng): Video: vp9 (Profile 0), yuv420p(tv, progressive), 799x770, SAR 1:1 DAR 799:770, 23 fps, 23 tbr, 1k tbn, 1k tbc (default)
Metadata:
alpha_mode : 1
File '3.webm' already exists. Overwrite ? [y/N] y
Stream mapping:
Stream #0:0 (vp9) -> concat:in0:v0
Stream #1:0 (vp9) -> concat:in1:v0
concat -> Stream #0:0 (libvpx-vp9)
Press [q] to stop, [?] for help
[libvpx-vp9 # 0x55f58406a540] v1.6.1
Output #0, webm, to '3.webm':
Metadata:
encoder : Lavf57.71.100
Stream #0:0: Video: vp9 (libvpx-vp9), yuv420p, 799x770 [SAR 1:1 DAR 799:770], q=-1--1, 200 kb/s, 23 fps, 1k tbn, 23 tbc (default)
Metadata:
encoder : Lavc57.89.100 libvpx-vp9
Side data:
cpb: bitrate max/min/avg: 0/0/0 buffer size: 0 vbv_delay: -1
frame= 200 fps=8.4 q=0.0 Lsize= 187kB time=00:00:08.65 bitrate= 176.8kbits/s speed=0.365x
video:185kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 1.011632%
`
I thought this had been fixed, but apparently the native VPx decoders still don't decode alpha, so you have to use the libvpx decoders.
ffmpeg -c:v libvpx-vp9 -i 1.webm -c:v libvpx-vp9 -i 2.webm -filter_complex "[0:v:0] 1:v:0]concat=n=2:v=1[outv]" -map "[outv]" 3.webm
Am converting a DVD extraction from an MKV container to an MPEG2 file. This is the command I am using:
ffmpeg -i title04.mkv -c:v copy -c:a copy title04.m2v
It creates the file but with no audio. Am not sure what I am missing as it isn't throwing any error (and usually if a stream isn't compatible with a container it complains).
Here is the output. Any ideas?
Guessed Channel Layout for Input Stream #0.1 : stereo
Input #0, matroska,webm, from 'title04.mkv':
Metadata:
encoder : libmakemkv v1.8.12 (1.3.0/1.4.1) darwin(x86-release)
creation_time : 2014-08-28 19:36:24
Duration: 00:00:11.34, start: 0.000000, bitrate: 4979 kb/s
Stream #0:0(eng): Video: mpeg2video (Main), yuv420p(tv), 720x480 [SAR 8:9 DAR 4:3], max. 7500 kb/s, 29.97 fps, 29.97 tbr, 1k tbn, 59.94 tbc
Stream #0:1(eng): Audio: pcm_s16le, 48000 Hz, 2 channels, s16, 1536 kb/s (default)
Metadata:
title : Stereo
Stream #0:2(eng): Subtitle: dvd_subtitle, 720x480 (default)
Output #0, mpeg2video, to 'title04.m2v':
Metadata:
encoder : Lavf55.48.100
Stream #0:0(eng): Video: mpeg2video, yuv420p, 720x480 [SAR 8:9 DAR 4:3], q=2-31, max. 7500 kb/s, 29.97 fps, 29.97 tbn, 29.97 tbc
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 340 fps=0.0 q=-1.0 Lsize= 4738kB time=00:00:11.31 bitrate=3431.4kbits/s
video:4738kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.000000%
m2v (mpeg 2 video) is a video only container. The audio stream is not included.
You should use .mpg or .mpeg as container format.