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.
Related
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?
Let's say I have:
video1.avi which is perfectly played (both sound and image) on my TV's USB media input
video2.avi which is not recognized by the TV: "Imposible to read this format"
I have tried lots of solutions, like:
ffmpeg -i video2.avi -codec:a libmp3lame -q:a 0 -ac 2 -ar 48000 -joint_stereo 0^
-codec:v libxvid -q:v 25 video2_reencoded.avi
and when I compare video1.avi with video2_reencoded.avi with MediaInfo, they look similar in most aspects, but finally the TV won't play video2_reencoded.avi.
Is there a way with ffmpeg, to replicate all the specifications of video1.avi (sound encoding properties, video encoding properties, image size, container type, etc.) on video2.avi?
Appendix: output of MediaInfo for the three videos. In this specific example, video2.avi and video2_reencoded.avi are half-working: image ok but not the sound. In other video examples I tried, video2.avi and video2_reencoded.avi would be both totally "Impossible to read".
video1.avi (i.e. working)
Format : AVI
Format/Info : Audio Video Interleave
File size : 352 MiB
Duration : 51 min 22 s
Overall bit rate : 959 kb/s
Writing application : VirtualDubMod 1.5.10.3 | ... || (build 2550/release)
Writing library : VirtualDubMod build 2550/release
Video
ID : 0
Format : MPEG-4 Visual
Format profile : Advanced Simple#L5
Format settings : BVOP1
Format settings, BVOP : 1
Format settings, QPel : No
Format settings, GMC : No warppoints
Format settings, Matrix : Default (MPEG)
Codec ID : XVID
Codec ID/Hint : XviD
Duration : 51 min 22 s
Bit rate : 821 kb/s
Width : 720 pixels
Height : 400 pixels
Display aspect ratio : 16:9
Frame rate : 25.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.114
Stream size : 302 MiB (86%)
Writing library : XviD 1.2.1 (UTC 2008-12-04)
Audio
ID : 1
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 3
Codec ID : 55
Codec ID/Hint : MP3
Duration : 51 min 22 s
Bit rate mode : Constant
Bit rate : 128 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Compression mode : Lossy
Stream size : 47.0 MiB (13%)
Alignment : Aligned on interleaves
Interleave, duration : 40 ms (1.00 video frame)
Interleave, preload duration : 504 ms
Writing library : LAME3.99r
Encoding settings : -m s -V 4 -q 2 -lowpass 17 -b 128
video2.avi (i.e. non-working)
Format : AVI
Format/Info : Audio Video Interleave
File size : 1.37 GiB
Duration : 2 h 12 min
Overall bit rate : 1 478 kb/s
Writing application : VirtualDubMod 1.5.10.2 Fr | ... || (build 2540/release)
Writing library : VirtualDubMod build 2540/release
Video
ID : 0
Format : MPEG-4 Visual
Format profile : Advanced Simple#L5
Format settings : BVOP1
Format settings, BVOP : 1
Format settings, QPel : No
Format settings, GMC : No warppoints
Format settings, Matrix : Default (H.263)
Muxing mode : Packed bitstream
Codec ID : XVID
Codec ID/Hint : XviD
Duration : 2 h 12 min
Bit rate : 1 084 kb/s
Width : 624 pixels
Height : 368 pixels
Display aspect ratio : 5:3
Frame rate : 25.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.189
Stream size : 1.00 GiB (73%)
Writing library : XviD 1.2.1 (UTC 2008-12-04)
Audio
ID : 1
Format : AC-3
Format/Info : Audio Coding 3
Codec ID : 2000
Duration : 2 h 12 min
Bit rate mode : Constant
Bit rate : 384 kb/s
Channel(s) : 6 channels
Sampling rate : 48.0 kHz
Compression mode : Lossy
Stream size : 364 MiB (26%)
Alignment : Split accross interleaves
Interleave, duration : 40 ms (1.00 video frame)
Interleave, preload duration : 512 ms
video2_reencoded.avi (i.e. non-working, reencoded, but still non-working)
Format : AVI
Format/Info : Audio Video Interleave
Format profile : OpenDML
File size : 1.13 GiB
Duration : 2 h 12 min
Overall bit rate : 1 227 kb/s
Writing application : Lavf57.26.100
Video
ID : 0
Format : MPEG-4 Visual
Format profile : Advanced Simple#L5
Format settings : BVOP1
Format settings, BVOP : 1
Format settings, QPel : No
Format settings, GMC : No warppoints
Format settings, Matrix : Default (H.263)
Muxing mode : Packed bitstream
Codec ID : XVID
Codec ID/Hint : XviD
Duration : 2 h 12 min
Bit rate : 1 084 kb/s
Width : 624 pixels
Height : 368 pixels
Display aspect ratio : 5:3
Frame rate : 25.000 FPS
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Compression mode : Lossy
Bits/(Pixel*Frame) : 0.189
Stream size : 1.00 GiB (88%)
Writing library : XviD 1.2.1 (UTC 2008-12-04)
Audio
ID : 1
Format : MPEG Audio
Format version : Version 1
Format profile : Layer 3
Codec ID : 55
Codec ID/Hint : MP3
Duration : 2 h 12 min
Bit rate mode : Constant
Bit rate : 128 kb/s
Channel(s) : 2 channels
Sampling rate : 48.0 kHz
Compression mode : Lossy
Stream size : 120 MiB (10%)
Alignment : Aligned on interleaves
Interleave, duration : 24 ms (0.60 video frame)
Sorry but unfortunately there is no such tool available. Currently the best you can get in this direction is the replication of h264 encoding parameters.
Ubuntu 14.04.1 with the real ffmpeg loaded (same problem with the avconv version).
I'm trying to take files created in MythTV with a HDPVR, cut the commercials and put the video into an MP4 container for use with MythRoku.
the command
ffmpeg -i $file -acodec copy -vcodec copy -f mp4 file.mp4
Works fine. Once I update the database, I can watch the file in MythRoku or Plex.
However, when I try to cut out the commercials, the audio gets out of sync by just over 1 second (audio delayed) whenever I cut past the 0 mark. Totem Video player and VLC both play the resulting video fine, but I can see a "hitch" at the beginning while they are syncing the audio, so I know the information on the audio sync is in the file somewhere. Mythroku and Plex both are out of sync when playing the file. The MythTV Frontend player actually does play it correctly, and I can hear the "hitch" as it syncs the audio.
After hours of reading posts and playing with settings, I've got it down to this:
If I say:
ffmpeg -i $file -acodec copy -vcodec copy -f mp4 -ss 0 -t <anything> out.mp4
The file is fine, plays both locally and in MythRoku/Plex
But if I advance the start any amount - even 1 second - audio is out of sync
ffmpeg -i $file -acodec copy -vcodec copy -f mp4 -ss 1 -t <anything> out.mp4
I've tried splitting the video (as mp4) and audio (as ac3) first, splitting them separately, and then putting them back together as the last step, but I get the same results.
The information is in the file - Totem, VLC and the Frontend all can figure it out. How can I get ffmpeg to figure out the sync and write the file so it's correct?
Original file:
mythtv#marvin:~$ mediainfo /var/lib/mythtv/recordings/2225_20140824001500.mpg
General
ID : 0 (0x0)
Complete name : /var/lib/mythtv/recordings/2225_20140824001500.mpg
Format : MPEG-TS
File size : 4.03 GiB
Duration : 1h 45mn
Overall bit rate mode : Variable
Overall bit rate : 5 491 Kbps
Video
ID : 4113 (0x1011)
Menu ID : 1 (0x1)
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Main#L4.0
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Format settings, GOP : M=4, N=32
Codec ID : 27
Duration : 1h 45mn
Bit rate mode : Variable
Bit rate : 4 831 Kbps
Maximum bit rate : 20.0 Mbps
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate : 59.940 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.087
Stream size : 3.55 GiB (88%)
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
Audio
ID : 4352 (0x1100)
Menu ID : 1 (0x1)
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Format settings, Endianness : Big
Codec ID : 129
Duration : 1h 45mn
Bit rate mode : Constant
Bit rate : 384 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Bit depth : 16 bits
Compression mode : Lossy
Delay relative to video : -6ms
Stream size : 289 MiB (7%)
File cut from 0:
mythtv#marvin:~$ mediainfo 2225_20140824001500_1.mp4
General
Complete name : 2225_20140824001500_1.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom
File size : 58.5 MiB
Duration : 1mn 45s
Overall bit rate mode : Variable
Overall bit rate : 4 676 Kbps
Writing application : Lavf54.63.104
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Main#L4.0
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Format settings, GOP : M=4, N=32
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1mn 45s
Bit rate mode : Variable
Bit rate : 4 281 Kbps
Maximum bit rate : 20.0 Mbps
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate mode : Variable
Frame rate : 59.940 fps
Minimum frame rate : 59.920 fps
Maximum frame rate : 59.960 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.077
Stream size : 53.6 MiB (92%)
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
Audio
ID : 2
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Format settings, Endianness : Big
Codec ID : ac-3
Duration : 1mn 45s
Bit rate mode : Constant
Bit rate : 384 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 4.81 MiB (8%)
File cut from 1 second with audio sync problem:
mythtv#marvin:~$ mediainfo 2225_20140824001500_2.mp4
General
Complete name : 2225_20140824001500_2.mp4
Format : MPEG-4
Format profile : Base Media
Codec ID : isom
File size : 68.0 MiB
Duration : 2mn 0s
Overall bit rate mode : Variable
Overall bit rate : 4 750 Kbps
Writing application : Lavf54.63.104
Video
ID : 1
Format : AVC
Format/Info : Advanced Video Codec
Format profile : Main#L4.0
Format settings, CABAC : Yes
Format settings, ReFrames : 4 frames
Format settings, GOP : M=4, N=32
Codec ID : avc1
Codec ID/Info : Advanced Video Coding
Duration : 1mn 58s
Bit rate mode : Variable
Bit rate : 4 394 Kbps
Maximum bit rate : 20.0 Mbps
Width : 1 280 pixels
Height : 720 pixels
Display aspect ratio : 16:9
Frame rate mode : Variable
Frame rate : 59.940 fps
Minimum frame rate : 59.920 fps
Maximum frame rate : 59.960 fps
Color space : YUV
Chroma subsampling : 4:2:0
Bit depth : 8 bits
Scan type : Progressive
Bits/(Pixel*Frame) : 0.080
Stream size : 62.3 MiB (92%)
Color primaries : BT.709
Transfer characteristics : BT.709
Matrix coefficients : BT.709
Audio
ID : 2
Format : AC-3
Format/Info : Audio Coding 3
Mode extension : CM (complete main)
Format settings, Endianness : Big
Codec ID : ac-3
Duration : 2mn 0s
Bit rate mode : Constant
Bit rate : 384 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Bit depth : 16 bits
Compression mode : Lossy
Stream size : 5.49 MiB (8%)
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.
I'm trying to encode some audio on Ubuntu 12.04 Linux. I need to use libfaac (using version 1.28) to encode and I want to encode at a very low bitrate - the total including transport stream overhead must be below 64kbps.
The input audio is: PCM, 48kHz, 2 channel, s16, 1536 kb/s
Using the faac command-line tool, I get the output below, encoding 5 minutes of audio - so there's plenty of time for the bitrate to average out. I cannot get it to go below 64kbps, or above 165kbps for that matter. I have tried setting some of the other parameters, but to no avail. When I set the bitrate > 64, it works fine. Looking through the libfaac code, i don't see anywhere that these limits are being imposed.
$ ./faac -b 40 -w -o /tmp/yellow-audio-40k.mp4 /tmp/yellow-audio.wav
Freeware Advanced Audio Coder
FAAC 1.28
Average bitrate: 64 kbps
Quantization quality: 100
Bandwidth: 5442 Hz
Object type: Low Complexity(MPEG-4) + M/S
Container format: MPEG-4 File Format (MP4)
Encoding /tmp/yellow-audio.wav to /tmp/yellow-audio-40k.mp4
frame | bitrate | elapsed/estim | play/CPU | ETA
14063/14063 (100%)| 64.2 | 10.7/10.7 | 27.91x | 0.0
$ mediainfo /tmp/yellow-audio-40k.mp4
General
Complete name : /tmp/yellow-audio-40k.mp4
Format : MPEG-4
Format profile : Base Media / Version 2
Codec ID : mp42
File size : 2.35 MiB
Duration : 5mn 0s
Overall bit rate mode : Variable
Overall bit rate : 65.7 Kbps
Encoded date : UTC 2012-12-05 00:03:38
Tagged date : UTC 2012-12-05 00:03:49
Writing application : FAAC 1.28
Audio
ID : 1
Format : AAC
Format/Info : Advanced Audio Codec
Format profile : LC
Codec ID : 40
Duration : 5mn 0s
Bit rate mode : Variable
Bit rate : 64.2 Kbps
Maximum bit rate : 73.7 Kbps
Channel(s) : 2 channels
Channel positions : Front: L R
Sampling rate : 48.0 KHz
Compression mode : Lossy
Stream size : 2.30 MiB (98%)
Language : English
Encoded date : UTC 2012-12-05 00:03:38
Tagged date : UTC 2012-12-05 00:03:49