when I run ffmpeg, I can see "default" audio and video stream:
Stream #0:0(und): Video: h264 (Constrained Baseline) (avc1 / 0x31637661), yuv420p, 960x400 [SAR 1:1 DAR 12:5], 3859 kb/s, 23.98 fps, 23.98 tbr, 24k tbn, 47.95 tbc
(default)
Metadata:
creation_time : 2013-05-03 22:50:47
handler_name : GPAC ISO Video Handler
Stream #0:1(und): Audio: aac (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 92 kb/s
(default)
Metadata:
creation_time : 1970-01-01 00:00:00
handler_name : SoundHandler
Stream #0:2: Video: mjpeg, yuvj420p(pc), 675x1000 [SAR 72:72 DAR 27:40], 90k tbr, 90k tbn, 90k tbc
As I understand, this stream selected by ffmpeg as input when encoding, if map option not set.
How can I get "default" stream using ffprobe ?
Sorry for English
Related
Env: Windows7, ffmpeg 4.2.2
copy the first 10 seconds from long.mp4 to UNO.mp4
copy sec 120 to sec 130 from long.mp4 to DUE.mp4
create List.txt with
file 'C:\Users\Admin\Videos\UNO.mp4'
file 'C:\Users\Admin\Videos\DUE.mp4'
here the ffprobe output of the two files:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'UNO.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.29.100
Duration: 00:00:10.04, start: 0.000000, bitrate: 671 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 640x360 [SAR 1:1 DAR 16:9], 536 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : ISO Media file produced by Google Inc. Created on: 09/18/2020.
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s (default)
Metadata:
handler_name : ISO Media file produced by Google Inc. Created on: 09/18/2020.
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'DUE.mp4':
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.29.100
Duration: 00:00:11.96, start: 0.000000, bitrate: 657 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, smpte170m/smpte170m/bt709), 640x360 [SAR 1:1 DAR 16:9], 524 kb/s, 25 fps, 25 tbr, 12800 tbn, 50 tbc (default)
Metadata:
handler_name : ISO Media file produced by Google Inc. Created on: 09/18/2020.
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
Metadata:
handler_name : ISO Media file produced by Google Inc. Created on: 09/18/2020.
use the two files as input to
ffmpeg -f concat -safe 0 -i "C:\Users\Admin\Videos\List.txt" -c copy "C:\Users\Admin\Videos\mergedVideo.mp4"
it outputs:
mov,mp4,m4a,3gp,3g2,mj2 # 00be7f80] Auto-inserting h264_mp4toannexb bitstream filter
nput #0, concat, from 'C:\Users\Admin\Videos\List.txt':
Duration: N/A, start: 0.000000, bitrate: 825 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 624x352 [SAR 1:1 DAR 39:22], 697 kb/s, 25 fps, 25
tbr, 90k tbn, 50 tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
handler_name : SoundHandler
utput #0, mp4, to 'C:\Users\Admin\Videos\mergedVideo.mp4':
Metadata:
encoder : Lavf58.29.100
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 624x352 [SAR 1:1 DAR 39:22], q=2-31, 697 kb/s, 25
fps, 25 tbr, 90k tbn, 90k tbc
Metadata:
handler_name : VideoHandler
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 128 kb/s
Metadata:
handler_name : SoundHandler
tream mapping:
Stream #0:0 -> #0:0 (copy)
Stream #0:1 -> #0:1 (copy)
then a long series of :
mp4 # 00c43c40] Non-monotonous DTS in output stream 0:0; previous: 899370, current: 720000; changing to 899371. This may result in incorrect timestamps in the output file.
at end as last messages :
rame= 552 fps=528 q=-1.0 Lsize= 2220kB time=00:00:20.01 bitrate= 908.4kbits/s speed=19.2x
ideo:1873kB audio:329kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: 0.827539%
When i play the output mergedVideo.mp4 with ffplay, it does not gove errors
it is only a time stamp problem, or some frames or some audio are lost ?
in the latter case, is there a parameter to correct the problem, or i have to re-encode ?
(to further test, i tried with avidemux an it concats UNO.mp4 and DUE.mp4 without re-encoding)
Thanks in advance to all for the support
Maurizio
First of all, unless you call FFmpeg with the -xerror option (which you didn't) "Non-monotonous DTS..." message is not an error. It's just a warning. It is just informing what it's doing for you, and thankfully its automatic adjustment indeed worked for your case base on your description.
It is making the adjustment because you are concatenate-and-copying streams, of which data frame carries timestamp (unlike WAV or MPEG streams). The concat demuxer likely cannot adjust the timestamp in the stream data on the fly (to avoid the warnings/corrections from the main ffmpeg program).
The bottom line. If the warning messages must go, change the log level to ignore warning: -loglevel error.
Reference ffmpeg.c Lines 817-834
When I tried to concat mp4 videos with the ffmpeg concat demuxer, the resulting video was out of sync starting from the end of the first video.
Although I use the same video resolution, fps, 128k audio bit-rate, it wasn't sufficient :
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'WhatsApp_Video_2021-10-20_at_6.45.53_AM-128kb.mp4':
Duration: 00:00:24.92, start: 0.000000, bitrate: 4098 kb/s
Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x720 [SAR 1:1 DAR 16:9], 3970 kb/s, 30 fps, 30 tbr, 19200 tbn, 60 tbc (default)
Stream #0:1(und): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 129 kb/s (default)
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'TOUT_N_ETAIT_PAS_ENCORE_ACCOMPLI_A_LA_CROIX_DR_N_GUESSAN_MICHEL__136-140__BzQKTvNYwlg__youtube_com.mp4':
Duration: 00:51:43.23, start: 0.000000, bitrate: 1932 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, smpte170m/bt470bg/bt709), 1280x720 [SAR 1:1 DAR 16:9], 1796 kb/s, 30 fps, 30 tbr, 15360 tbn, 60 tbc (default)
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 127 kb/s (default)
What are the common encoding parameters needed to concat losslessly mp4 videos the the ffmpeg concat demuxer ?
I recorded the audio and video stream from a streaming with ffmpeg. when I go to re-encode the file using libx264, the video in the movements looks bad and grainy as in the image.
Where did I go wrong?
this is the code I used
ffmpeg -i input.mp4 -c:v libx264 -c:a aac output.mp4
and these are mediainfo of original file
Metadata:
major_brand : isom
minor_version : 1
compatible_brands: isom
creation_time : 2020-03-19T22:43:32.000000Z
Duration: 00:39:51.99, start: 0.000000, bitrate: 1300 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1280x1080 [SAR 3:2 DAR 16:9], Closed Captions, 1268 kb/s, 59.94 fps, 59.94 tbr, 90k tbn, 59.94 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(spa): Audio: aac (HE-AACv2) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 22 kb/s (default)
Metadata:
handler_name : SoundHandler
mediainfo of the file recoded
Metadata:
major_brand : isom
minor_version : 512
compatible_brands: isomiso2avc1mp41
encoder : Lavf58.29.100
Duration: 00:39:51.99, start: 0.000000, bitrate: 7924 kb/s
Stream #0:0(und): Video: h264 (High) (avc1 / 0x31637661), yuv420p, 1920x1080 [SAR 1:1 DAR 16:9], Closed Captions, 7892 kb/s, 59.94 fps, 59.94 tbr, 60k tbn, 119.88 tbc (default)
Metadata:
handler_name : VideoHandler
Stream #0:1(spa): Audio: aac (HE-AACv2) (mp4a / 0x6134706D), 44100 Hz, stereo, fltp, 22 kb/s (default)
Metadata:
handler_name : SoundHandler
How can I recode the file without loss of quality? (sorry for my poor english)
I concatenated multiple videos using the following ffmpeg command:
ffmpeg -i video1.avi video2.avi -f concat -c copy -safe 0 -o concat.mov
Are there any chance that original files could be splitted back from concat.mov? Since this is a concat and copy, are there any markers in concat.mov that I could utilize?
Update: original video codecs:
Input #0, avi, from 'DVR___2017-08-10_09.17.56.AVI':
Metadata:
encoder : DVR ZIR32 SW: 1.1.001
Duration: 00:20:00.00, start: 0.000000, bitrate: 897 kb/s
Stream #0:0: Video: mjpeg (MJPG / 0x47504A4D), yuvj422p(pc, bt470bg/unknown/unknown), 640x360 [SAR 1:1 DAR 16:9], 703 kb/s, 5 fps, 5 tbr, 5 tbn, 5 tbc
Stream #0:1: Audio: pcm_s16le ([1][0][0][0] / 0x0001), 12000 Hz, mono, s16, 192 kb/s
Concatenated file:
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 'DVR___2017-08-07_19.55.36.AVI.mov':
Metadata:
major_brand : qt
minor_version : 512
compatible_brands: qt
encoder : Lavf57.71.100
Duration: 00:52:58.80, start: 0.000000, bitrate: 875 kb/s
Stream #0:0(eng): Video: mjpeg (jpeg / 0x6765706A), yuvj422p(pc, bt470bg/unknown/unknown), 640x360 [SAR 1:1 DAR 16:9], 682 kb/s, 5 fps, 5 tbr, 10240 tbn, 10240 tbc (default)
Metadata:
handler_name : DataHandler
Stream #0:1(eng): Audio: pcm_s16le (sowt / 0x74776F73), 12000 Hz, mono, s16, 192 kb/s (default)
Metadata:
handler_name : DataHandler
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.