Mplayer: Thumbnails every second - linux

I want to create thumbnails every second from a video, but for some reason mplayer skips frames.
for example, on a video of 2mn 49s duration I got only 59 thumbnails instead of 169
What i've tried:
mplayer -nosound -vo jpg:outdir=. -sstep 1 file.flv
mediainfo file.flv
General
Complete name : file.flv
Format : Flash Video
File size : 12.6 MiB
Duration : 2mn 49s
Overall bit rate : 626 Kbps
Tagging application : Yet Another Metadata Injector for FLV - Version 1.8
Video
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High#L3.0
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Codec ID : 7
Duration : 2mn 48s
Bit rate : 555 Kbps
Width : 704 pixels
Height : 396 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 30.000 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.066
Stream size : 11.2 MiB (89%)
Writing library : x264 core 125
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / 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=48 / lookahead_threads=6 / 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=abr / mbtree=1 / bitrate=555 / ratetol=1.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00

You can use ffmpeg.
PNG
ffmpeg -i input -r 1 output_%03d.png
JPG
ffmpeg -i input -r 1 -qscale:v 2 output_%03d.jpg
-r 1 will output 1 frame per second. -r 1/5 will output 1 frame per 5 seconds.
This will result in numerically sequential files starting with output_001.jpg.
For JPG you can vary output quality with -qscale:v. Range is 2 (best quality) to 31 (worst quality).
You can add -frames:v if you want to limit the number of output files, such as -frames:v 10 for 10 output images.

Related

Is there iOS browser support for mp4 with h264 video and 4 (or more) AAC audio channels?

I added 4 channels (two stereo) of AAC audio to an mp4 with an h264 video using ffmpeg. I am using the Web Audio Api to split the channels and merge them back together for independent control in sync with the video. This is working successfully on Windows and macOs browsers (Chrome, Firefox, Safari, Opera, Edge), but the file is not playable on iOS (Safari and Chrome). I am waiting for an android device to test on that platform, but from what I've gathered this would work. Does anyone have any insight into this issue? Thank you in advance!
I have added the log of a mediainfo query below, as well as the html code I'm returning from a React application (also tested outside of React), and an error log from videojs (also tested bypassing videojs).
Complete name : multi_channel.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/avc1/mp41)
File size : 25.7 MiB
Duration : 4 min 33 s
Overall bit rate : 787 kb/s
Writing application : Lavf58.76.100
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High#L3.1
Format settings : CABAC / 4 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 4 frames
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 4 min 33 s
Bit rate : 525 kb/s
Width : 1 280 pixels
Height : 536 pixels
Display aspect ratio : 2.40:1
Frame rate mode : Constant
Frame rate : 23.976 (24000/1001) FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.032
Stream size : 17.1 MiB (67%)
Title : ISO Media file produced by Google Inc. Created on: 09/03/2019.
Writing library : x264 core 163 r3060 5db6aa6
Encoding settings : cabac=1 / ref=3 / deblock=1:0:0 / analyse=0x3:0x113 / me=hex / subme=7 / 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=17 / 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=2 / keyint=250 / keyint_min=23 / 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
Menus : 3
Codec configuration box : avcC
Audio
ID : 2
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : mp4a-40-2
Duration : 4 min 33 s
Source duration : 4 min 33 s
Source_Duration_LastFrame : -22 ms
Bit rate mode : Constant
Bit rate : 257 kb/s
Channel(s) : 4 channels
Channel layout : L R Ls Rs
Sampling rate : 44.1 kHz
Frame rate : 43.066 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 8.37 MiB (33%)
Source stream size : 8.37 MiB (33%)
Default : Yes
Alternate group : 1
Menus : 3
mdhd_Duration : 273764
Menu #1
ID : 3
Codec ID : text
Duration : 4 min 33 s
Language : English
Menu For : 1,2
00:00:00.000 : Tempo: 120.0
Menu #2
00:00:00.000 : Tempo: 120.0
<video
playsInline
crossOrigin="anonymous"
ref={videoEl}
width="750"
height="500"
controls >
<source src={constants.mp4} type={'video/mp4'}/>
</video>
ERRORVIDEOJS: ERROR: (CODE:3 MEDIA_ERR_DECODE) The media playback was aborted due to a corruption problem or because the media used features your browser did not support.
Can you add some code - like the video attribute - iOS requires the "playsinline" attribute - which would be the first thing to check.
If that is present - what does the console log tell you?

Is it possible to change volume with no reencode with ffmpeg?

I just had this question because I used the following command with ffmpeg:
ffmpeg -i input.wav -filter:a "volume=0.2" output.wav
Following the documentation here: https://trac.ffmpeg.org/wiki/AudioVolume
However, when I created the new file, the output was half the size of the input and the bitrate of the audio track was reduced as well.
So my questions are:
Is the bitrate supposed to decrease with decreasing and increasing volume like so?
Is it possible to change volume without reencoding with ffmpeg?
I'm no expert but the way I increase volume doesn't seem to be to cause an issue.. e.g. bitrate of audio is the same... File size is similar too.
ffmpeg -i ac.mp4 -af volume=7 -vcodec copy ac2.mp4
Note- the following is a programming question involving c# but somebody mentions the above Increase/Decrease audio volume using FFmpeg
For documentation
ffmpeg -? doesn't show much. If you do ffmpeg -? | grep "vol" then all it mentions is "-vol volume" And if you do ffmpeg -? | grep "-af" then all it says is -af filter_graph set audio filters" No mention of what audio filters you can use.
But speaking to some ffmpeg experts, they mentioned re documentation..
"
There's the ffmpeg-filters manpage as well as -h filter=NAME which shows you a brief of the options usable for the filter.
On the web you have the ffmpeg-all one too https://www.ffmpeg.org/ffmpeg-all.html
https://ffmpeg.org/ffmpeg-filters.html#volume
"
See for yourself the difference between the files, from mediainfo and DIR
Notice that both files, source and destination, are similar size, 195MB. The source is 195,166,205 bytes, the dest is 195,837,608 bytes. so a very small difference in size.
Notice that
there is no difference in bitrate
C:\Users\User\Downloads\ac>mediainfo ac.mp4 | find /i "bit"
Overall bit rate : 383 kb/s
Bit rate : 252 kb/s
Bit depth : 8 bits
Bits/(Pixel*Frame) : 0.010
Bit rate mode : Constant
Bit rate : 128 kb/s
C:\Users\User\Downloads\ac>mediainfo ac2.mp4 | find /i "bit"
Overall bit rate : 384 kb/s
Bit rate : 252 kb/s
Bit depth : 8 bits
Bits/(Pixel*Frame) : 0.010
Bit rate mode : Constant
Bit rate : 128 kb/s
C:\Users\User\Downloads\ac>
Here is all the mediainfo data for each file so you can decide for yourself if you can see from that, any substantial difference that took place when the volume was changed.
C:\Users\User\Downloads\ac>mediainfo ac.mp4
General
Complete name : ac.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/avc1/mp41)
File size : 186 MiB
Duration : 1 h 7 min
Overall bit rate : 383 kb/s
Writing application : Lavf58.20.100
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High#L3.2
Format settings : CABAC / 1 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 1 frame
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1 h 7 min
Bit rate : 252 kb/s
Width : 1 366 pixels
Height : 768 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 24.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.010
Stream size : 122 MiB (66%)
Writing library : x264 core 157 r2945 72db437
Encoding settings : cabac=1 / ref=1 / deblock=1:0:0 / analyse=0x3:0x3 / me=dia / subme=1 / psy=1 / psy_rd=1.00:0.00 / mixed_ref
=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=4 / lookahead_threads=4 /
sliced_threads=1 / slices=4 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=0 / weightp=1 / keyint=250 / keyint_
min=24 / scenecut=40 / intra_refresh=0 / rc=crf / mbtree=0 / crf=26.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Codec configuration box : avcC
Audio
ID : 2
Format : AAC LC SBR
Format/Info : Advanced Audio Codec Low Complexity with Spectral Band Replication
Commercial name : HE-AAC
Format settings : NBC
Codec ID : mp4a-40-5
Duration : 1 h 7 min
Duration_LastFrame : -23 ms
Bit rate mode : Constant
Bit rate : 128 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Frame rate : 23.438 FPS (2048 SPF)
Compression mode : Lossy
Stream size : 62.2 MiB (33%)
Default : Yes
Alternate group : 1
C:\Users\User\Downloads\ac>mediainfo ac2.mp4
General
Complete name : ac2.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom (isom/iso2/avc1/mp41)
File size : 187 MiB
Duration : 1 h 7 min
Overall bit rate : 384 kb/s
Writing application : Lavf58.31.104
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : High#L3.2
Format settings : CABAC / 1 Ref Frames
Format settings, CABAC : Yes
Format settings, Reference frames : 1 frame
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1 h 7 min
Bit rate : 252 kb/s
Width : 1 366 pixels
Height : 768 pixels
Display aspect ratio : 16:9
Frame rate mode : Constant
Frame rate : 24.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.010
Stream size : 122 MiB (66%)
Writing library : x264 core 157 r2945 72db437
Encoding settings : cabac=1 / ref=1 / deblock=1:0:0 / analyse=0x3:0x3 / me=dia / subme=1 / psy=1 / psy_rd=1.00:0.00 / mixed_ref
=0 / me_range=16 / chroma_me=1 / trellis=0 / 8x8dct=1 / cqm=0 / deadzone=21,11 / fast_pskip=1 / chroma_qp_offset=0 / threads=4 / lookahead_threads=4 /
sliced_threads=1 / slices=4 / nr=0 / decimate=1 / interlaced=0 / bluray_compat=0 / constrained_intra=0 / bframes=0 / weightp=1 / keyint=250 / keyint_
min=24 / scenecut=40 / intra_refresh=0 / rc=crf / mbtree=0 / crf=26.0 / qcomp=0.60 / qpmin=0 / qpmax=69 / qpstep=4 / ip_ratio=1.40 / aq=1:1.00
Codec configuration box : avcC
Audio
ID : 2
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : mp4a-40-2
Duration : 1 h 7 min
Duration_LastFrame : -19 ms
Bit rate mode : Constant
Bit rate : 128 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 48.0 kHz
Frame rate : 46.875 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 62.4 MiB (33%)
Default : Yes
Alternate group : 1
C:\Users\User\Downloads\ac>dir ac.mp4
Volume in drive C has no label.
Volume Serial Number is 4645-5DCE
Directory of C:\Users\User\Downloads\ac
11/03/2021 15:14 195,166,205 ac.mp4
1 File(s) 195,166,205 bytes
0 Dir(s) 2,360,127,488 bytes free
C:\Users\User\Downloads\ac>dir ac2.mp4
Volume in drive C has no label.
Volume Serial Number is 4645-5DCE
Directory of C:\Users\User\Downloads\ac
11/03/2021 15:28 195,837,608 ac2.mp4
1 File(s) 195,837,608 bytes
0 Dir(s) 2,360,127,488 bytes free
C:\Users\User\Downloads\ac>
Okay as someone from Reddit kindly explained to me, I should be able to change the volume without reencoding, however, my input codec was pcm_f32le and the default setting for the output codec for ffmpeg without any specifiers is pcm_f16le.
The first one pcm_f32le is 32 bits, so it stores more information than the second which is 16 bits.
So the answer is:
Yes it is because in this case I was reencoding unknowingly to a codec with less information.
Actually no, it still reencoding. The best option is to use the same code I used above with an extra specifier:
ffmpeg -i input.wav -filter:a "volume=0.2" -c:a pcm_f32le output.wav
The codec for input and output must be the same as in both 32 bit or 16 bit or else I have to add a specifier which I was shown how to do by the same person on Reddit.
However, this is still reencoding whenever you add a filter.

How to convert aac to ogg opus keeping bit rate and sample rate unchanged

I'm trying to convert a .aac file to .opus but after inspecting with ffprobe I get different bit and sample rates.
While input file's audio stream bit rate is 245995, the output file's audio stream has no bit rate specified - "format" shows bit rate of 118788.
While input file's audio stream sample rate is 44100, the output's is 48000.
ffprobe -v error -show_format -show_streams input.aac
[STREAM]
index=0
codec_name=aac
codec_long_name=AAC (Advanced Audio Coding)
profile=LC
codec_type=audio
codec_time_base=1/44100
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=fltp
sample_rate=44100
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/28224000
start_pts=N/A
start_time=N/A
duration_ts=106533390807
duration=3774.567418
bit_rate=245995
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
[/STREAM]
[FORMAT]
filename=input.aac
nb_streams=1
nb_programs=0
format_name=aac
format_long_name=raw ADTS AAC (Advanced Audio Coding)
start_time=N/A
duration=3774.567418
size=116065589
bit_rate=245995
probe_score=51
[/FORMAT]
ffmpeg -nostdin -i input.aac -c:a libopus output.opus
ffmpeg version N-93449-g013f714 Copyright (c) 2000-2019 the FFmpeg developers
built with gcc 7 (Ubuntu 7.3.0-27ubuntu1~18.04)
configuration: --prefix=/home/vagrant/ffmpeg_build --pkg-config-flags=--static --extra-cflags=-I/home/vagrant/ffmpeg_build/include --extra-ldflags=-L/home/vagrant/ffmpeg_build/lib --extra-libs='-lpthread -lm' --bindir=/home/vagrant/bin --enable-gpl --enable-libass --enable-libfdk-aac --enable-libfreetype --enable-libmp3lame --enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --enable-nonfree
libavutil 56. 26.100 / 56. 26.100
libavcodec 58. 47.105 / 58. 47.105
libavformat 58. 26.101 / 58. 26.101
libavdevice 58. 7.100 / 58. 7.100
libavfilter 7. 48.100 / 7. 48.100
libswscale 5. 4.100 / 5. 4.100
libswresample 3. 4.100 / 3. 4.100
libpostproc 55. 4.100 / 55. 4.100
[aac # 0x55d4b7e21d80] Estimating duration from bitrate, this may be inaccurate
Input #0, aac, from 'input.aac':
Duration: 01:02:54.57, bitrate: 245 kb/s
Stream #0:0: Audio: aac (LC), 44100 Hz, stereo, fltp, 245 kb/s
Stream mapping:
Stream #0:0 -> #0:0 (aac (native) -> opus (libopus))
[libopus # 0x55d4b7e3f8c0] No bit rate set. Defaulting to 96000 bps.
Output #0, opus, to 'output.opus':
Metadata:
encoder : Lavf58.26.101
Stream #0:0: Audio: opus (libopus), 48000 Hz, stereo, flt, 96 kb/s
Metadata:
encoder : Lavc58.47.105 libopus
size= 52103kB time=00:59:53.21 bitrate= 118.8kbits/s speed=66.2x
video:0kB audio:51733kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.715930%
ffprobe -v error -show_format -show_streams output.opus
[STREAM]
index=0
codec_name=opus
codec_long_name=Opus (Opus Interactive Audio Codec)
profile=unknown
codec_type=audio
codec_time_base=1/48000
codec_tag_string=[0][0][0][0]
codec_tag=0x0000
sample_fmt=fltp
sample_rate=48000
channels=2
channel_layout=stereo
bits_per_sample=0
id=N/A
r_frame_rate=0/0
avg_frame_rate=0/0
time_base=1/48000
start_pts=0
start_time=0.000000
duration_ts=172473677
duration=3593.201604
bit_rate=N/A
max_bit_rate=N/A
bits_per_raw_sample=N/A
nb_frames=N/A
nb_read_frames=N/A
nb_read_packets=N/A
DISPOSITION:default=0
DISPOSITION:dub=0
DISPOSITION:original=0
DISPOSITION:comment=0
DISPOSITION:lyrics=0
DISPOSITION:karaoke=0
DISPOSITION:forced=0
DISPOSITION:hearing_impaired=0
DISPOSITION:visual_impaired=0
DISPOSITION:clean_effects=0
DISPOSITION:attached_pic=0
DISPOSITION:timed_thumbnails=0
TAG:ENCODER=Lavc58.47.105 libopus
[/STREAM]
[FORMAT]
filename=output.opus
nb_streams=1
nb_programs=0
format_name=ogg
format_long_name=Ogg
start_time=0.000000
duration=3593.201604
size=53353867
bit_rate=118788
probe_score=100
[/FORMAT]
How can I preserve the quality of the input file? Am I missing something in the ffmpeg cmd?
There is no sample rate of 44100 with Opus, so in this case you have to resample.
The available sampling rates for Opus are 8, 12, 16, 24, or 48 kHz (according to the RFC6716 section Resampling).
There might be no matching bitrate either. Then you are anyway re-encoding and hence quality loss. And finally an attempt to match bitrates does not imply that the data is of equal encoding quality, even though certain correlation exists.

ffmpeg does not recognize audio stream in video

I have these flv files that exported from Adobe Connect and I want to extract their audio with ffmpeg. ffmpeg does not recognize the audio on some of them. This log is from one file that has issues:
>ffmpeg.exe -i r7anupl75gl_0_1965937.flv test1.mp3
ffmpeg version N-76123-g002b049 Copyright (c) 2000-2015 the FFmpeg
built with gcc 5.2.0 (GCC)
configuration: --enable-gpl --enable-version3 --disable-w32threads
libavutil 55. 4.100 / 55. 4.100
libavcodec 57. 7.100 / 57. 7.100
libavformat 57. 8.102 / 57. 8.102
libavdevice 57. 0.100 / 57. 0.100
libavfilter 6. 11.100 / 6. 11.100
libswscale 4. 0.100 / 4. 0.100
libswresample 2. 0.100 / 2. 0.100
libpostproc 54. 0.100 / 54. 0.100
[flv # 0000000000522140] Could not find codec parameters for stream 1
(Audio: none, 0 channels): unknown codec
Consider increasing the value for the 'analyzeduration' and 'probesize'
options
Input #0, flv, from 'r7anupl75gl_0_1965937.flv':
Metadata:
lasttimestamp : 5026
lastkeyframetimestamp: 5022
audiodelay : 0
canSeekToEnd : false
creationdate : unknown
metadatacreator : Manitu Group FLV MetaData Injector 2
videosize : 251586025
audiosize : 55776880
datasize : 516
Duration: 01:23:47.75, start: 0.000000, bitrate: 489 kb/s
Stream #0:0: Video: vp6f, yuv420p, 1184x704, 1k tbr, 1k tbn, 1k tbc
Stream #0:1: Audio: none, 0 channels
Output #0, mp3, to 'test1.mp3':
Output file #0 does not contain any stream
Note: audio codec is Nellymoser Asao and this command works successfully for some files.
Consider increasing the value for the 'analyzeduration' and 'probesize'
The problem is in first 10-15 min the flv file doesn't actually have any audio. By increasing probesize and analyzeduration it looks further in the file to find audio and detect it.
In my scenario I have to set analyzeduration bigger than 5000000 (5 seconds).

ffmpeg is failing to convert mov files from iPhone 4

I'm having issue with converting mov files from iPhone 4.
Running this command:
I, [2014-09-15T03:48:33.245231 #9676] INFO -- : Running transcoding...
ffmpeg -y -i /Users/lun/client/bookagoo/public/uploads/5405e9b0486f75a36c100000/video/1410727644xqxzdoxf-IMG_0040_1_.MOV -ss 5 -vframes 1 -f image2 /Users/lun/client/bookagoo/public/uploads/5405e9b0486f75a36c100000/video/1410727644xqxzdoxf-IMG_0040_1_-edited.jpg
E, [2014-09-15T03:48:33.321367 #9676] ERROR -- : Failed encoding...
ffmpeg -y -i /Users/lun/client/bookagoo/public/uploads/5405e9b0486f75a36c100000/video /1410727644xqxzdoxf-IMG_0040_1_.MOV -ss 5 -vframes 1 -f image2 /Users/lun/client/bookagoo/public/uploads/5405e9b0486f75a36c100000/video/1410727644xqxzdoxf-IMG_0040_1_-edited.jpg
My ffmpeg gives me errors like this:
FFMPEG::Error: Failed encoding.Errors: no output file created. Full output: ffmpeg version 2.3.1 Copyright (c) 2000-2014 the FFmpeg developers
built on Aug 20 2014 02:23:29 with Apple LLVM version 5.1 (clang-503.0.40) (based on LLVM 3.4svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.3.1 --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 --enable-libtheora --enable-libvorbis --enable-libvpx
libavutil 52. 92.100 / 52. 92.100
libavcodec 55. 69.100 / 55. 69.100
libavformat 55. 48.100 / 55. 48.100
libavdevice 55. 13.102 / 55. 13.102
libavfilter 4. 11.100 / 4. 11.100
libavresample 1. 3. 0 / 1. 3. 0
libswscale 2. 6.100 / 2. 6.100
libswresample 0. 19.100 / 0. 19.100
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '/Users/lun/client/bookagoo/public/uploads/5405e9b0486f75a36c100000/video/1410641311nyv99k1j-IMG_0040_1_.MOV':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2014-07-20 09:47:08
model : iPhone 4
model-rus : iPhone 4
encoder : 7.0.4
encoder-rus : 7.0.4
date : 2014-07-20T13:47:08+0400
date-rus : 2014-07-20T13:47:08+0400
make : Apple
make-rus : Apple
Duration: 00:00:01.84, start: 0.000000, bitrate: 827 kb/s
Stream #0:0(und): Video: h264 (Baseline) (avc1 / 0x31637661), yuv420p(tv, smpte170m), 480x360, 742 kb/s, 23.98 fps, 23.98 tbr, 600 tbn, 1200 tbc (default)
Metadata:
rotate : 90
creation_time : 2014-07-20 09:47:08
handler_name : Core Media Data Handler
encoder : H.264
Side data:
displaymatrix: rotation of -90.00 degrees
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 44100 Hz, mono, fltp, 63 kb/s (default)
Metadata:
creation_time : 2014-07-20 09:47:08
handler_name : Core Media Data Handler
[swscaler # 0x7fe1e9800600] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to '/Users/lun/client/bookagoo/public/uploads/5405e9b0486f75a36c100000/video/1410641311nyv99k1j-IMG_0040_1_-edited.jpg':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
make-rus : Apple
model : iPhone 4
model-rus : iPhone 4
make : Apple
encoder : Lavf55.48.100
date : 2014-07-20T13:47:08+0400
date-rus : 2014-07-20T13:47:08+0400
Stream #0:0(und): Video: mjpeg, yuvj420p, 480x360, q=2-31, 200 kb/s, 23.98 fps, 23.98 tbn, 23.98 tbc (default)
Metadata:
rotate : 90
creation_time : 2014-07-20 09:47:08
handler_name : Core Media Data Handler
encoder : Lavc55.69.100 mjpeg
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
frame= 0 fps=0.0 q=0.0 Lsize=N/A time=00:00:00.00 bitrate=N/A
video:0kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
Output file is empty, nothing was encoded (check -ss / -t / -frames parameters if used)
It's only happening for mov files. There are couple of tricky places it looks like it's trying to take screenshot from a video.
Maybe anyone witnessed anything similar and can give me a tip?
The problem
Your command is telling ffmpeg to skip the first 5 seconds, but the console output indicates that the input duration is only 00:00:01.84 (just under 2 seconds).
Using the select filter
If you're trying to get a screen shot from a variety of inputs with varying durations you can look at the select filter instead of using -ss.
Example to create a mosaic of various scenes:
ffmpeg -i video.avi -vf select='gt(scene\,0.4)',scale=160:120,tile -frames:v 1 preview.png
Using ffprobe with -ss
Alternatively, with some scripting you can use ffprobe to get the duration, and then calculate an appropriate value for -ss.

Resources