I've been searching everywhere to work out how to extract N images from a video using FFmpeg. All the answers involve playing with the rate setting (-r). However, I'm having some fundamental problems with the rate. According to the docs, the following should produce one frame per second.
ffmpeg -i input.mov -f image2 -r 1 preview-%d.jpeg
If input.mov is 7 seconds long, I would expect to get 7 images. However, I get 10. I also tried on a video 119 seconds long, but I got 122 images. I'm getting 3 more images than expected. What am I missing?
For example, with this ~3 second video I get six frames https://www.dropbox.com/s/8eke6q2gz1kgk1f/example.mov?dl=0
benblack$ ffmpeg -i example.mov -f image2 -r 1 preview-%d.jpeg
ffmpeg version 2.1.4 Copyright (c) 2000-2014 the FFmpeg developers
built on Mar 2 2014 13:38:24 with Apple LLVM version 5.0 (clang-500.2.79) (based on LLVM 3.3svn)
configuration: --prefix=/usr/local/Cellar/ffmpeg/2.1.4 --enable-shared --enable-pthreads --enable-gpl --enable-version3 --enable-nonfree --enable-hardcoded-tables --enable-avresample --enable-vda --cc=clang --host-cflags= --host-ldflags= --enable-libx264 --enable-libfaac --enable-libmp3lame --enable-libxvid
libavutil 52. 48.101 / 52. 48.101
libavcodec 55. 39.101 / 55. 39.101
libavformat 55. 19.104 / 55. 19.104
libavdevice 55. 5.100 / 55. 5.100
libavfilter 3. 90.100 / 3. 90.100
libavresample 1. 1. 0 / 1. 1. 0
libswscale 2. 5.101 / 2. 5.101
libswresample 0. 17.104 / 0. 17.104
libpostproc 52. 3.100 / 52. 3.100
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'example.mov':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
creation_time : 2015-02-11 16:52:01
Duration: 00:00:02.83, start: 0.000000, bitrate: 736 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 638x468 [SAR 1:1 DAR 319:234], 726 kb/s, 59.29 fps, 60 tbr, 6k tbn, 12k tbc (default)
Metadata:
creation_time : 2015-02-11 16:52:01
handler_name : Core Media Data Handler
[swscaler # 0x7fdb13008c00] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'preview-%d.jpeg':
Metadata:
major_brand : qt
minor_version : 0
compatible_brands: qt
encoder : Lavf55.19.104
Stream #0:0(und): Video: mjpeg, yuvj420p, 638x468 [SAR 1:1 DAR 319:234], q=2-31, 200 kb/s, 90k tbn, 1 tbc (default)
Metadata:
creation_time : 2015-02-11 16:52:01
handler_name : Core Media Data Handler
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> mjpeg)
Press [q] to stop, [?] for help
frame= 6 fps=0.0 q=0.0 Lsize=N/A time=00:00:06.00 bitrate=N/A dup=0 drop=162
video:283kB audio:0kB subtitle:0 global headers:0kB muxing overhead -100.007598%
I don't know why -r doesn't produce what I expect. However, I managed to extract N frames by using -vf and -vsync:
ffmpeg -i example.mov -f image2 -vsync vfr -vf "select='not(mod(n,17)')" -vframes 10 preview-%d.jpeg
round(number of frames in video/number of frames wanted) = 168/10 = 17. The number of frames in the video can be found using ffprobe:
ffprobe -v error -select_streams v:0 -show_entries stream=nb_frames -i example.mov
The vframes setting is to limit the number of frames, because due to rounding we might sometimes generate one more frame.
Another popular way to extract images from videos is a frame per second.
If you want to extract a portion of images from a video use the -ss option to specify the starting timestamp, and the -t option to specify the encoding duration, eg from 52 seconds in for 1 minute and 5 seconds:
ffmpeg.exe -i simpsonsRockBottom.mp4 -ss 00:00:52 -t 00:01:05 -r 1/1 $filename%03d.jpg
The timestamps need to be in HH:MM:SS.xxx format or in seconds.
If you don't specify the -t option it will go to the end.
Related
I have two video streams from which I'd like to take one frame of each, both of them are RTSP. I'm using the same FFMPEG instruction for both of them but changing the URL of the stream, the first one works but the second one throws the error:
method SETUP failed: 455 Method Not Valid In This State
Can anyone tell me what could be the reason for this error and how to solve it?
WORKING
ffmpeg -ss 1 -i rtsp://streamreader:trudat55#69.84.126.216:88/videoMain -an -vcodec mjpeg -vframes 1 -aspect 16:9 -q:v 2 -y test.jpg
ffmpeg version 2.8.2 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.2 (Debian 4.9.2-10)
configuration: --enable-gpl --enable-avresample --enable-libopencore-amrnb --enable-libx264 --enable-libxvid --enable-postproc --enable-version3 --enable-shared --enable-pic --extra-ldexeflags=-pie
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[rtsp # 0x55a60a0a7420] UDP timeout, retrying with TCP
Guessed Channel Layout for Input Stream #0.1 : mono
Input #0, rtsp, from 'rtsp://streamreader:password#69.84.126.216:88/videoMain':
Metadata:
title : IP Camera Video
comment : videoMain
Duration: N/A, start: 0.200044, bitrate: N/A
Stream #0:0: Video: h264 (Baseline), yuv420p, 640x480, 50 tbr, 90k tbn, 180k tbc
Stream #0:1: Audio: pcm_mulaw, 8000 Hz, 1 channels, s16, 64 kb/s
[swscaler # 0x55a60a102460] deprecated pixel format used, make sure you did set range correctly
Output #0, image2, to 'test.jpg':
Metadata:
title : IP Camera Video
comment : videoMain
encoder : Lavf56.40.101
Stream #0:0: Video: mjpeg, yuvj420p(pc), 640x480 [SAR 4:3 DAR 16:9], q=2-31, 200 kb/s, 50 fps, 50 tbn, 50 tbc
Metadata:
encoder : Lavc56.60.100 mjpeg
Stream mapping:
Stream #0:0 -> #0:0 (h264 (native) -> mjpeg (native))
Press [q] to stop, [?] for help
frame= 1 fps=0.5 q=2.0 Lsize=N/A time=00:00:00.02 bitrate=N/A dup=1 drop=1
video:66kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
NOT WORKING
ffmpeg -ss 1 -i rtsp://camaras.corredorautomotriz.cl:554/live.sdp -an -vcodec mjpeg -vframes 1 -aspect 16:9 -q:v 2 -y test.jpg
ffmpeg version 2.8.2 Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.9.2 (Debian 4.9.2-10)
configuration: --enable-gpl --enable-avresample --enable-libopencore-amrnb --enable-libx264 --enable-libxvid --enable-postproc --enable-version3 --enable-shared --enable-pic --extra-ldexeflags=-pie
libavutil 54. 31.100 / 54. 31.100
libavcodec 56. 60.100 / 56. 60.100
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 40.101 / 5. 40.101
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[rtsp # 0x55b98f2de420] UDP timeout, retrying with TCP
[rtsp # 0x55b98f2de420] method SETUP failed: 455 Method Not Valid In This State
[rtsp # 0x55b98f2de420] Could not find codec parameters for stream 0 (Video: mjpeg, none(bt470bg/unknown/unknown)): unspecified size
Consider increasing the value for the 'analyzeduration' and 'probesize' options
Input #0, rtsp, from 'rtsp://camaras.corredorautomotriz.cl:554/live.sdp':
Metadata:
title : RTSP server
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mjpeg, none(bt470bg/unknown/unknown), 90k tbr, 90k tbn, 90k tbc
Stream #0:1: Data: none
Output #0, image2, to 'test.jpg':
Output file #0 does not contain any stream
I found that if I specify that the protocol is TCP with the instruction -rtsp_transport tcp then i don't get an error:
ffmpeg -ss 5 -rtsp_transport tcp -i rtsp://camaras.corredorautomotriz.cl:554/live.sdp -s 640x480 -aspect 16:9 -b:v 800k -r 24 video.flv
But I would still like to know the reason and solution of the problem I got before, because I am not sure I can use this parameter. Anyone knows?
Thanks
As I see in your output, ffmpeg failed to determine input stream type in the second case (rtsp://camaras.corredorautomotriz.cl:554/live.sdp).
I checked it, and it got me mpeg4:
Input #0, rtsp, from 'rtsp://camaras.corredorautomotriz.cl:554/live.sdp':
Metadata:
title : RTSP server
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: mpeg4 (Simple Profile), yuv420p, 720x480 [SAR 1:1 DAR 3:2], 30 tbr, 30k tbn
Thus possibly you compiled ffmpeg without mpeg4 decoder (or with broken decoder).
I have a video of just under an hour recorded but it appears to be damaged somehow. The file format is h264 MP4 and the file size is 2.3 GB, so I'm confident that the information is there, just that the file format is damaged. How could I approach fixing it?
So far, I've tried a simple ffmpeg copy operation:
>ffmpeg -i video_28_07_2015_15_16_05.mp4 -c copy out.mp4
ffmpeg version N-73895-g323ec6b Copyright (c) 2000-2015 the FFmpeg developers
built with gcc 4.8 (Ubuntu 4.8.4-2ubuntu1~14.04)
configuration: --extra-libs=-ldl --prefix=/opt/ffmpeg --enable-avresample --disable-debug --enable-nonfree --enable-gpl --enable-version3 --enable-libopencore-amrnb --enable-libopencore-amrwb --disable-decoder=amrnb --disable-decoder=amrwb --enable-libpulse --enable-libdcadec --enable-libx264 --enable-libx265 --enable-libfdk-aac --enable-libvorbis --enable-libmp3lame --enable-libopus --enable-libvpx --enable-libspeex --enable-libass --enable-avisynth --enable-libsoxr --enable-libxvid --enable-libvo-aacenc --enable-libvidstab
libavutil 54. 28.100 / 54. 28.100
libavcodec 56. 50.101 / 56. 50.101
libavformat 56. 40.101 / 56. 40.101
libavdevice 56. 4.100 / 56. 4.100
libavfilter 5. 25.100 / 5. 25.100
libavresample 2. 1. 0 / 2. 1. 0
libswscale 3. 1.101 / 3. 1.101
libswresample 1. 2.101 / 1. 2.101
libpostproc 53. 3.100 / 53. 3.100
[mov,mp4,m4a,3gp,3g2,mj2 # 0x2a78e00] Could not find codec parameters for stream 0 (Video: h264 (avc1 / 0x31637661), none, 1280x720): unspecified pixel format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
video_28_07_2015_15_16_05.mp4: could not find codec parameters
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'video_28_07_2015_15_16_05.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
creation_time : 2015-07-28 14:12:50
Duration: 00:56:43.53, bitrate: 5345 kb/s
Stream #0:0(eng): Video: h264 (avc1 / 0x31637661), none, 1280x720, SAR 1:1 DAR 16:9, 30 fps, 90k tbr, 90k tbn, 180k tbc (default)
Metadata:
creation_time : 2015-07-28 14:12:50
handler_name : VideoHandle
[mp4 # 0x2a7b260] Codec for stream 0 does not use global headers but container format requires global headers
Output #0, mp4, to 'out.mp4':
Metadata:
major_brand : isom
minor_version : 0
compatible_brands: isom3gp4
encoder : Lavf56.40.101
Stream #0:0(eng): Video: h264 ([33][0][0][0] / 0x0021), none, 1280x720 [SAR 1:1 DAR 16:9], q=2-31, 30 fps, 90k tbr, 90k tbn, 90k tbc (default)
Metadata:
creation_time : 2015-07-28 14:12:50
handler_name : VideoHandle
Stream mapping:
Stream #0:0 -> #0:0 (copy)
Press [q] to stop, [?] for help
frame= 0 fps=0.0 q=-1.0 Lsize= 0kB 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)
I have no idea of what to try next and would appreciate suggestions and guidance.
Ok, so untrunc by Federico Ponchio worked. The procedure (on Ubuntu 14.04 LTS) was as follows:
sudo apt-get -y install libavformat-dev libavcodec-dev libavutil-dev
wget https://github.com/ponchio/untrunc/archive/master.zip
unzip master.zip
cd untrunc-master
g++ -o untrunc file.cpp main.cpp track.cpp atom.cpp mp4.cpp -L/usr/local/lib -lavformat -lavcodec -lavutil
./untrunc video_12_02_2015_15_02_58.mp4 video_28_07_2015_15_16_05.mp4
The first argument is an example working video from the same device and the second argument is the broken video. The program ran for a short time and a new working file called video_28_07_2015_15_16_05.mp4_fixed.mp4 was created.
Try to use my project: https://github.com/bookkojot/mp4fixer
Similar to untruc, it requires reference file.
Seems that Federico Ponchio made his untrunc available for everybody (non-Linux users also ;-) ): untrunc.it
I have rtmp stream created by flash player in h264 but when i convert it to video or tumbnail using ffmpeg it some times works after very very long time and some time not work but if I create a stream with Flash Media live encoder on same FMS server the command below works fine. At the same time if I try the stream in player it works well and fine.
I am using IP so DNS resolving issue is not possible either I think.
ffmpeg -i rtmp://xxx.xxx.xx.xx/live/bdeef2c065509361e78fa8cac90aac741cc5ee29 -r 1 -an -updatefirst 1 -y thumbnail.jpg
Following is when it worked aftre 15 - 20 minutes
ffmpeg -i "rtmp://xxx.xxx.xx.xx/live/bdeef2c065509361e78fa8cac90aac741cc5ee29 live=1" -r 1 -an -updatefirst 1 -y thumb.jpg
[root#test ~]# ffmpeg -i rtmp://38.125.41.20/live/bdeef2c065509361e78fa8cac90aac741cc5ee29 -r 1 -an -updatefirst 1 -y thumbnail.jpg
ffmpeg version N-49953-g7d0e3b1-syslint Copyright (c) 2000-2013 the FFmpeg developers
built on Feb 14 2013 15:29:40 with gcc 4.4.6 (GCC) 20120305 (Red Hat 4.4.6-4)
configuration: --prefix=/usr/local/cpffmpeg --enable-shared --enable-nonfree --enable-gpl --enable-pthreads --enable-libopencore-amrnb --enable-decoder=liba52 --enable-libopencore-amrwb --enable-libfaac --enable-libmp3lame --enable-libtheora --enable-libvorbis --enable-libx264 --enable-libxvid --extra-cflags=-I/usr/local/cpffmpeg/include/ --extra-ldflags=-L/usr/local/cpffmpeg/lib --enable-version3 --extra-version=syslint
libavutil 52. 17.101 / 52. 17.101
libavcodec 54. 91.103 / 54. 91.103
libavformat 54. 63.100 / 54. 63.100
libavdevice 54. 3.103 / 54. 3.103
libavfilter 3. 37.101 / 3. 37.101
libswscale 2. 2.100 / 2. 2.100
libswresample 0. 17.102 / 0. 17.102
libpostproc 52. 2.100 / 52. 2.100
[flv # 0x14c0100] Stream #1: not enough frames to estimate rate; consider increasing probesize
[flv # 0x14c0100] Could not find codec parameters for stream 1 (Audio: none, 0 channels): unspecified sample format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[flv # 0x14c0100] Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from 'rtmp://xxx.xxx.xx.xx/bdeef2c065509361e78fa8cac90aac741cc5ee29':
Metadata:
keyFrameInterval: 15
quality : 90
level : 3.1
bandwith : 0
codec : H264Avc
fps : 15
profile : baseline
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (Baseline), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 15 tbr, 1k tbn, 30 tbc
Stream #0:1: Audio: none, 0 channels
Output #0, image2, to 'thumbnail.jpg':
Metadata:
keyFrameInterval: 15
quality : 90
level : 3.1
bandwith : 0
codec : H264Avc
fps : 15
profile : baseline
encoder : Lavf54.63.100
Stream #0:0: Video: mjpeg, yuvj420p, 640x480 [SAR 1:1 DAR 4:3], q=2-31, 200 kb/s, 90k tbn, 1 tbc
Stream mapping:
Stream #0:0 -> #0:0 (h264 -> mjpeg)
Press [q] to stop, [?] for help
frame= 2723 fps=1.3 q=1.6 size=N/A time=00:45:23.00 bitrate=N/A dup=8 drop=12044
and on stopping the stream by closing the browser running the flash player which is publishing the video I get the following
[flv # 0x23684e0] Could not find codec parameters for stream 1 (Audio: none, 0 channels): unspecified sample format
Consider increasing the value for the 'analyzeduration' and 'probesize' options
[flv # 0x23684e0] Estimating duration from bitrate, this may be inaccurate
Input #0, flv, from 'rtmp://xxx.xxx.xx.xx/live/bdeef2c065509361e78fa8cac90aac741cc5ee29':
Metadata:
keyFrameInterval: 15
quality : 90
bandwith : 0
level : 3.1
codec : H264Avc
fps : 15
profile : baseline
Duration: N/A, start: 0.000000, bitrate: N/A
Stream #0:0: Video: h264 (Baseline), yuv420p, 640x480 [SAR 1:1 DAR 4:3], 15 tbr, 1k tbn, 30 tbc
Stream #0:1: Audio: none, 0 channels
when if i stop the stream it quickly creates a thumbnail file where as running stream is an issue.
I found the reason and cause of this, if a stream created by flash not no microphone selected the audio channel is 0 in rtmp published stream so for that reason the audio codec part of rtmp goes into some kind of loop and not returns and goes further . I have found the cause . but looking for a way to get rid if this loop incase there is no audio channel . may be might have to modify the source code of rtmp and compile again .
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 4 years ago.
The community reviewed whether to reopen this question 12 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I have just installed ffmpeg and I am trying to encode all my uploaded videos to .mp4 file. Most of the users currently upload .mov and I want to convert every video to .mp4.
I am running the command as follows:
ffmpeg -i movie.mov -vcodec copy -acodec cop out.mp4
But all I am getting is the following errors
ffmpeg version 0.8.5, Copyright (c) 2000-2011 the FFmpeg developers
built on Aug 19 2012 11:38:20 with clang 3.1 (tags/Apple/clang-318.0.61)
configuration: --enable-nonfree --enable-gpl --enable-version3 --enable-postproc --enable-swscale --enable-avfilter --enable-libmp3lame --enable-libvorbis --enable-libtheora --enable-libfaac --enable-libxvid --enable-libx264 --enable-libvpx --enable-hardcoded-tables --enable-shared --enable-pthreads --disable-indevs --cc=clang
libavutil 51. 9. 1 / 51. 9. 1
libavcodec 53. 7. 0 / 53. 7. 0
libavformat 53. 4. 0 / 53. 4. 0
libavdevice 53. 1. 1 / 53. 1. 1
libavfilter 2. 23. 0 / 2. 23. 0
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'movie.mov':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2012-03-28 07:13:20
Duration: 00:00:26.23, start: 0.000000, bitrate: 12974 kb/s
Stream #0.0(eng): Video: mjpeg, yuvj420p, 1280x720 [PAR 72:72 DAR 16:9], 12972 kb/s, 11.67 fps, 600 tbr, 600 tbn, 600 tbc
Metadata:
creation_time : 2012-03-28 07:13:20
File 'out.mp4' already exists. Overwrite ? [y/N] y
Output #0, mp4, to 'out.mp4':
Metadata:
major_brand : qt
minor_version : 537199360
compatible_brands: qt
creation_time : 2012-03-28 07:13:20
encoder : Lavf53.4.0
Stream #0.0(eng): Video: mjpeg, yuvj420p, 1280x720 [PAR 72:72 DAR 16:9], q=2-31, 12972 kb/s, 600 tbn, 600 tbc
Metadata:
creation_time : 2012-03-28 07:13:20
Stream mapping:
Stream #0.0 -> #0.0
Press [q] to stop, [?] for help
frame= 121 fps= 0 q=-1.0 size= 16408kB time=00:00:10.08 bitrate=13332.2kbitsframe= 306 fps= 0 q=-1.0 Lsize= 41543kB time=00:00:26.12 bitrate=13025.0kbits/s
video:41538kB audio:0kB global headers:0kB muxing overhead 0.012531%
The command to just stream it to a new container (mp4) needed by some applications like Adobe Premiere Pro without encoding (fast) is:
ffmpeg -i input.mov -qscale 0 output.mp4
Alternative as mentioned in the comments, which re-encodes with best quaility (-qscale 0):
ffmpeg -i input.mov -q:v 0 output.mp4
I have a mp4 file cutted from a H.264/AAC stream with Wowza Media Server.
After the cutting, the file was forced to mp4 format with the following command:
ffmpeg -i wowza_output_file -vcodec copy -acodec copy -f mp4 -y wowza_output_file_copy
From there I renamed it to test_f4v.mp4 and took ffprobe, to take a look at the file:
ffprobe version 0.8, Copyright (c) 2007-2011 the FFmpeg developers
built on Jul 20 2011 13:32:19 with gcc 4.4.3
configuration: --enable-gpl --enable-version3 --enable-nonfree --enable-postproc --enable-libfaac --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libtheora --enable-libvorbis --enable-libx264
libavutil 51. 9. 1 / 51. 9. 1
libavcodec 53. 7. 0 / 53. 7. 0
libavformat 53. 4. 0 / 53. 4. 0
libavdevice 53. 1. 1 / 53. 1. 1
libavfilter 2. 23. 0 / 2. 23. 0
libswscale 2. 0. 0 / 2. 0. 0
libpostproc 51. 2. 0 / 51. 2. 0
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'test_f4v.mp4':
Metadata:
major_brand : f4v
minor_version : 0
compatible_brands: isommp42m4v
creation_time : 2012-04-23 12:36:06
Duration: 01:00:01.84, start: 0.000000, bitrate: 2004 kb/s
Stream #0.0(eng): Video: h264 (Baseline), yuv420p, 854x480 [PAR 1:1 DAR 427:240], 1903 kb/s, 25 fps, 25 tbr, 90k tbn, 50 tbc
Metadata:
creation_time : 2012-04-23 12:36:06
Stream #0.1(eng): Audio: aac, 48000 Hz, stereo, s16, 96 kb/s
Metadata:
creation_time : 2012-04-23 12:36:06
Now there is a problem. I need a file, which has the following meta data:
major_brand : mp42
compatible_brands: isom
Is there a way to remux the mp4 file to get the major_brand and compatible_brands to the described values with ffmpeg?
You can set arbitrary metadata using the -metadata flag for FFmpeg.
From the man page:
-metadata[:metadata_specifier] key=value (output,per-metadata)
Set a metadata key/value pair.
An optional metadata_specifier may be given to set metadata on
streams or chapters. See "-map_metadata" documentation for details.
This option overrides metadata set with "-map_metadata". It is also
possible to delete metadata by using an empty value.
For example, for setting the title in the output file:
ffmpeg -i in.avi -metadata title="my title" out.flv
To set the language of the first audio stream:
ffmpeg -i INPUT -metadata:s:a:1 language=eng OUTPUT
I don't know much about Wowza formatting, but since you're just copying the actual stream data and only changing the packaging, you could try the HandBrakeCLI for conversion to mp4. By default it sets major_brand to mp42 and compatible_brands to mp42isomavc1. Perhaps close enough?