Re: [FFmpeg-user] Why are these different?

2024-02-07 Thread Mark Filipak

On 07/02/2024 16.53, Paul B Mahol wrote:

On Wed, Feb 7, 2024 at 10:28 PM Mark Filipak 
wrote:


Hi Carl,

On 07/02/2024 13.56, Carl Zwanzig wrote:

On 2/7/2024 10:34 AM, Mark Filipak wrote:

Okay. Why are they different?


Because the containers are different? An mp4 container is not the same

as an mkv (or avi or mpeg),

they must have different demuxers.


They are the same source, same container. The only difference is command.

ffmpeg -ss 20.061708333 -copyts -i %SOURCE% -map 0 -c copy -sn -dn
-muxdelay 0 %TARGET%
ffmpeg -copyts -i %SOURCE% -map 0 -ss 20.061708333 -c copy -sn -dn
-muxdelay 0 %TARGET%

Why do the results differ? They're not a little different. They're very
different. The DTSs differ.
The PTSs differ. The cutting points differ by a couple hundred frames.
Even some of the packet
lengths differ! This is serious.

I can't tell if the GOPs differ -- DTS-sorted v PTS-sorted -- because it's
impossible to correlate
'framecrc' results and 'showinfo' results.



use -v debug


Here ya go, Paul. Logs are attached.

ffmpeg started on 2024-02-07 at 19:09:53
Report written to "ffmpeg-20240207-190953.log"
Log level: 48
Command line:
"C:\\CMD & tiny apps\\ffmpeg\\ffmpeg.exe" -report -v debug -copyts -i "h:\\BDMV\\STREAM\\00305.m2ts" -map 0 -ss 20.061708333 -to 35 -c copy -sn -dn -muxdelay 0 "c:\\FANNY AND ALEXANDER, '-i -ss -to'.m2ts"
ffmpeg version 2023-11-09-git-acf63d5350-full_build-www.gyan.dev Copyright (c) 2000-2023 the FFmpeg developers
  built with gcc 12.2.0 (Rev10, Built by MSYS2 project)
  configuration: --enable-gpl --enable-version3 --enable-static --pkg-config=pkgconf --disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv --enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma --enable-libsnappy --enable-zlib --enable-librist --enable-libsrt --enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray --enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libaribcaption --enable-libdav1d --enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e --enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 --enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl --enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass --enable-frei0r --enable-libfreetype --enable-libfribidi --enable-libharfbuzz --enable-liblensfun --enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf --enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec --enable-nvenc --enable-dxva2 --enable  libavutil  58. 32.100 / 58. 32.100
  libavcodec 60. 33.100 / 60. 33.100
  libavformat60. 17.100 / 60. 17.100
  libavdevice60.  4.100 / 60.  4.100
  libavfilter 9. 13.100 /  9. 13.100
  libswscale  7.  6.100 /  7.  6.100
  libswresample   4. 13.100 /  4. 13.100
  libpostproc57.  4.100 / 57.  4.100
Splitting the commandline.
Reading option '-report' ... matched as option 'report' (generate a report) with argument '1'.
Reading option '-v' ... matched as option 'v' (set logging level) with argument 'debug'.
Reading option '-copyts' ... matched as option 'copyts' (copy timestamps) with argument '1'.
Reading option '-i' ... matched as output url with argument 'h:\BDMV\STREAM\00305.m2ts'.
Reading option '-map' ... matched as option 'map' (set input stream mapping) with argument '0'.
Reading option '-ss' ... matched as option 'ss' (set the start time offset) with argument '20.061708333'.
Reading option '-to' ... matched as option 'to' (record or transcode stop time) with argument '35'.
Reading option '-c' ... matched as option 'c' (codec name) with argument 'copy'.
Reading option '-sn' ... matched as option 'sn' (disable subtitle) with argument '1'.
Reading option '-dn' ... matched as option 'dn' (disable data) with argument '1'.
Reading option '-muxdelay' ... matched as option 'muxdelay' (set the maximum demux-decode delay) with argument '0'.
Reading option 'c:\FANNY AND ALEXANDER, '-i -ss -to'.m2ts' ... matched as output url.
Finished splitting the commandline.
Parsing a group of options: global .
Applying option report (generate a report) with argument 1.
Applying option v (set logging level) with argument debug.
Applying option copyts (copy timestamps) with argument 1.
Successfully parsed a group of options.
Parsing a group of options: input url h:\BDMV\STREAM\00305.m2ts.
Successfully parsed a group of options.
Opening an input file: h:\BDMV\STREAM\00305.m2ts.
[AVFormatContext @ 005a31c0] Opening 'h:\BDMV\STREAM\00305.m2ts' for reading
[file @ 005bb740] Setting default whitelist 'file,crypto,data'
[mpegts @ 005a31c0] Format mpegts probed with size=2048 and score=50
[mpegts @ 005a31c0] stream=0 stream_type=1b pid=1011 prog_reg_desc=HDMV
[mpegts @ 005a31c0] stream=1 stream_type=86 pid=1100 prog_reg_desc=HDMV
[mpegts @ 005a31c0] stream=2 stream_type=90 pid=1200 prog_reg_

Re: [FFmpeg-user] Why are these different?

2024-02-07 Thread Mark Filipak

On 07/02/2024 16.53, Paul B Mahol wrote:

On Wed, Feb 7, 2024 at 10:28 PM Mark Filipak 
wrote:


Hi Carl,

On 07/02/2024 13.56, Carl Zwanzig wrote:

On 2/7/2024 10:34 AM, Mark Filipak wrote:

Okay. Why are they different?


Because the containers are different? An mp4 container is not the same

as an mkv (or avi or mpeg),

they must have different demuxers.


They are the same source, same container. The only difference is command.

ffmpeg -ss 20.061708333 -copyts -i %SOURCE% -map 0 -c copy -sn -dn
-muxdelay 0 %TARGET%
ffmpeg -copyts -i %SOURCE% -map 0 -ss 20.061708333 -c copy -sn -dn
-muxdelay 0 %TARGET%

Why do the results differ? They're not a little different. They're very
different. The DTSs differ.
The PTSs differ. The cutting points differ by a couple hundred frames.
Even some of the packet
lengths differ! This is serious.

I can't tell if the GOPs differ -- DTS-sorted v PTS-sorted -- because it's
impossible to correlate
'framecrc' results and 'showinfo' results.



use -v debug

One of them IIRC uses trim filters for seeking


I will try. Thank you.

They are both trimming, just at differing points.
They are both cutting off hundreds of leading audio packets but they are both leaving leading audio 
packets, 52 for one and 54 for the other, that should be cut off.
In the first, the cut-point I-frame immediately follows the not-cut-off audio packets, but in the 
other, the correct cut-point I-frame is hundreds of video frames later.

They both are leaving other audio packets that come after the cut point but 
have lower PTSs.
They both leave the 'next' B-frame (which should be cut off) as though they're working on DTS-order 
instead of PTS-order.


I think there are bugs in the frame reordering _and_ in video v audio packet handling when cutting 
_and_ in the '-ss' handling.


I moved the location of '-ss' on a lark just to see if putting it after '-i' would produce better 
results; the results were worse.



___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-user] Why are these different?

2024-02-07 Thread Paul B Mahol
On Wed, Feb 7, 2024 at 10:28 PM Mark Filipak 
wrote:

> Hi Carl,
>
> On 07/02/2024 13.56, Carl Zwanzig wrote:
> > On 2/7/2024 10:34 AM, Mark Filipak wrote:
> >> Okay. Why are they different?
> >
> > Because the containers are different? An mp4 container is not the same
> as an mkv (or avi or mpeg),
> > they must have different demuxers.
>
> They are the same source, same container. The only difference is command.
>
> ffmpeg -ss 20.061708333 -copyts -i %SOURCE% -map 0 -c copy -sn -dn
> -muxdelay 0 %TARGET%
> ffmpeg -copyts -i %SOURCE% -map 0 -ss 20.061708333 -c copy -sn -dn
> -muxdelay 0 %TARGET%
>
> Why do the results differ? They're not a little different. They're very
> different. The DTSs differ.
> The PTSs differ. The cutting points differ by a couple hundred frames.
> Even some of the packet
> lengths differ! This is serious.
>
> I can't tell if the GOPs differ -- DTS-sorted v PTS-sorted -- because it's
> impossible to correlate
> 'framecrc' results and 'showinfo' results.
>
>
use -v debug

One of them IIRC uses trim filters for seeking

--Mark.
>
>
> ___
> ffmpeg-user mailing list
> ffmpeg-user@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-user] Why are these different?

2024-02-07 Thread Mark Filipak

Hi Carl,

On 07/02/2024 13.56, Carl Zwanzig wrote:

On 2/7/2024 10:34 AM, Mark Filipak wrote:

Okay. Why are they different?


Because the containers are different? An mp4 container is not the same as an mkv (or avi or mpeg), 
they must have different demuxers.


They are the same source, same container. The only difference is command.

ffmpeg -ss 20.061708333 -copyts -i %SOURCE% -map 0 -c copy -sn -dn -muxdelay 0 
%TARGET%
ffmpeg -copyts -i %SOURCE% -map 0 -ss 20.061708333 -c copy -sn -dn -muxdelay 0 
%TARGET%

Why do the results differ? They're not a little different. They're very different. The DTSs differ. 
The PTSs differ. The cutting points differ by a couple hundred frames. Even some of the packet 
lengths differ! This is serious.


I can't tell if the GOPs differ -- DTS-sorted v PTS-sorted -- because it's impossible to correlate 
'framecrc' results and 'showinfo' results.


--Mark.


___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-user] Why are these different?

2024-02-07 Thread Carl Zwanzig

On 2/7/2024 10:34 AM, Mark Filipak wrote:

Okay. Why are they different?


Because the containers are different? An mp4 container is not the same as an 
mkv (or avi or mpeg), they must have different demuxers.


z!
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-user] Why are these different?

2024-02-07 Thread Mark Filipak

On 07/02/2024 10.06, Paul B Mahol wrote:

On Wed, Feb 7, 2024 at 2:43 AM Mark Filipak 
wrote:



Why are these different?



This is all about seeking, and that depends 10% on internal demuxer
implementation of container.

Okay. Why are they different?

___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


Re: [FFmpeg-user] Why are these different?

2024-02-07 Thread Paul B Mahol
On Wed, Feb 7, 2024 at 2:43 AM Mark Filipak 
wrote:

> Why are these different?
>
> Looking only at the first 5 video frames:
>
> ffmpeg -ss 20.061708333 -copyts -i %SOURCE% -map 0 -c copy -sn -dn
> -muxdelay 0 %TARGET%
> produces this:
> 0,2846606,2854113, 3753,   640646, 0x3a5a0c45
> 0,2850360,2850360, 3753,   640646, 0xfed1d09a <== error
> 0,2854113,2861621, 3753,   640646, 0x02208727
>
> 0,2857867,2857867, 3753,   640646, 0x108abb16
> 0,2861621,2869128, 3753,   640646, 0xfd51ca41
>
> ffmpeg -copyts -i %SOURCE% -map 0 -ss 20.061708333 -c copy -sn -dn
> -muxdelay 0 %TARGET%
> produces this:
> 0,  50062,  61323, 3753,   640646, 0x12a26bc2
> 0,  53816,  53816, 3753,   415846, 0xb16fcb71 <== error
> 0,  57569,  57569, 3753,   123879, 0xf2721eb8 <== error
> 0,  61323,  68831, 3753,   126929, 0xe73f80e5
> 0,  65077,  65077, 3753,   124619, 0x20a2a8d5
>
> They have the same '-copyts'. They should have the same DTSs & PTSs. They
> don't.
> They have the same '-muxdelay 0'. They should both have no delay. The 2nd
> has delay.
> The packet with CRC=0x3a5a0c45 is packet 0 in the first and packet 264 in
> the second.
>
> 'showinfo' shows only frames and uses bogus PTSs. 'framecrc' shows only
> packets, not frames. So it
> doesn't seem possible to correlate their information.
>
>
This is all about seeking, and that depends 10% on internal demuxer
implementation of container.


> --Mark.
> ___
> ffmpeg-user mailing list
> ffmpeg-user@ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
>
> To unsubscribe, visit link above, or email
> ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".
>
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-user] h264_mp4toannexb does not store a proper frame-rate.

2024-02-07 Thread Wodzu
Hi,   I have an mp4 file, that I want to convert to Annex B. The file 
properties are:     Duration: 01:59:59.97, start: 0.00, bitrate: 1221 kb/s  
    Stream #0:0(und): Video: h264 (Main) (avc1 / 0x31637661), yuvj420p(pc, 
bt470bg/bt470bg/smpte170m), 1280x720, 1221 kb/s, 15 fps, 15 tbr, 15360 tbn, 60 
tbc (default)I am converting to Annex B this way:   ffmpeg -i file.mp4 
-vcodec copy -vbsf h264_mp4toannexb -an output_file.264   After running ffprobe 
on the output_file.264:     Duration: N/A, bitrate: N/A      Stream #0:0: 
Video: h264 (Main), yuvj420p(pc, bt470bg/bt470bg/smpte170m, progressive), 
1280x720, 30 fps, 30 tbr, 1200k tbn, 60 tbc   As you can see, the duration 
information has been lost and fps is now 30 fps. It it possible to retain the 
original FPS?   Cheers,   Bruce
___
ffmpeg-user mailing list
ffmpeg-user@ffmpeg.org
https://ffmpeg.org/mailman/listinfo/ffmpeg-user

To unsubscribe, visit link above, or email
ffmpeg-user-requ...@ffmpeg.org with subject "unsubscribe".


[FFmpeg-user] Issues regarding Ffmpeg video HLS conversion command

2024-02-07 Thread Aditya Singh via ffmpeg-user
The Ffmpeg command used to convert a video to HLS format can be also executed 
via php's exec() function.
We can dump the log in a php variable using following syntax with flag '2>&1'

command:
exec('ffmpeg -y -i "D:/HlsEncryptionProject/encTestVideo.mp4" -preset slow -g 
48 -sc_threshold 0 -map 0:0 -map 0:1 -map 0:0 -map 0:1 -map 0:0 -map 0:1 -s:v:0 
1920*1080 -b:v:0 286k -s:v:1 1280*720 -b:v:1 2500k -s:v:2 630*360 -b:v:2 1000k 
-c:a copy -var_stream_map "v:0,a:0,name:1080p v:1,a:1,name:720p 
v:2,a:2,name:360p" -master_pl_name "MLSFS002.m3u8" -f hls -hls_time 30 
-hls_key_info_file "D:/HlsEncryptionProject/content/videos/enc.keyinfo" 
-hls_playlist_type vod -hls_list_size 0 -hls_segment_filename 
"D:/HlsEncryptionProject/content/videos/vid_%v/MLSFS002%d.ts" 
D:/HlsEncryptionProject/content/videos/MLSFS002/vid_%v/MLSFS002.m3u8 2>&1', 
$output, $returnCode);

Output:
"ffmpeg version 2023-01-01-git-62da0b4a74-full_build-www.gyan.dev Copyright (c) 
2000-2023 the FFmpeg developers",
  "  built with gcc 12.1.0 (Rev2, Built by MSYS2 project)",
  "  configuration: --enable-gpl --enable-version3 --enable-static 
--disable-w32threads --disable-autodetect --enable-fontconfig --enable-iconv 
--enable-gnutls --enable-libxml2 --enable-gmp --enable-bzlib --enable-lzma 
--enable-libsnappy --enable-zlib --enable-librist --enable-libsrt 
--enable-libssh --enable-libzmq --enable-avisynth --enable-libbluray 
--enable-libcaca --enable-sdl2 --enable-libaribb24 --enable-libdav1d 
--enable-libdavs2 --enable-libuavs3d --enable-libzvbi --enable-librav1e 
--enable-libsvtav1 --enable-libwebp --enable-libx264 --enable-libx265 
--enable-libxavs2 --enable-libxvid --enable-libaom --enable-libjxl 
--enable-libopenjpeg --enable-libvpx --enable-mediafoundation --enable-libass 
--enable-frei0r --enable-libfreetype --enable-libfribidi --enable-liblensfun 
--enable-libvidstab --enable-libvmaf --enable-libzimg --enable-amf 
--enable-cuda-llvm --enable-cuvid --enable-ffnvcodec --enable-nvdec 
--enable-nvenc --enable-d3d11va --enable-dxva2 --enable-libvpl --enable-libs
 haderc --enable-vulkan --enable-libplacebo --enable-opencl --enable-libcdio 
--enable-libgme --enable-libmodplug --enable-libopenmpt 
--enable-libopencore-amrwb --enable-libmp3lame --enable-libshine 
--enable-libtheora --enable-libtwolame --enable-libvo-amrwbenc --enable-libilbc 
--enable-libgsm --enable-libopencore-amrnb --enable-libopus --enable-libspeex 
--enable-libvorbis --enable-ladspa --enable-libbs2b --enable-libflite 
--enable-libmysofa --enable-librubberband --enable-libsoxr 
--enable-chromaprint",
  "  libavutil  57. 43.100 / 57. 43.100",
  "  libavcodec 59. 55.103 / 59. 55.103",
  "  libavformat59. 34.102 / 59. 34.102",
  "  libavdevice59.  8.101 / 59.  8.101",
  "  libavfilter 8. 53.100 /  8. 53.100",
  "  libswscale  6.  8.112 /  6.  8.112",
  "  libswresample   4.  9.100 /  4.  9.100",
  "  libpostproc56.  7.100 / 56.  7.100",
  "Input #0, mov,mp4,m4a,3gp,3g2,mj2, from 
'D:/HlsEncryptionProject/encTestVideo.mp4':",
  "  Metadata:",
  "major_brand : isom",
  "minor_version   : 512",
  "compatible_brands: isomiso2avc1mp41",
  "encoder : Lavf55.33.100",
  "  Duration: 00:01:00.40, start: 0.00, bitrate: 624 kb/s",
  "  Stream #0:0[0x1](eng): Video: h264 (High) (avc1 / 0x31637661), 
yuv420p(progressive), 630x332, 621 kb/s, 25 fps, 25 tbr, 12800 tbn (default)",
  "Metadata:",
  "  handler_name: VideoHandler",
  "  vendor_id   : [0][0][0][0]",
  "Stream map '0:1' matches no streams.",
  "To ignore this, add a trailing '?' to the map."


But when we try to generate error output (for example, via inputting a corrupt 
video url or by omitting a part of ffmpeg command) via these flags, then Ffmpeg 
is generating the same type of error mentioned above.

So the issue is every time when we want to log the error in case the tool fails 
to convert the video into HLS format,
Ffmpeg just generates same error. Are there some ways by which we can improve 
the logging system of ffmpeg
for error/warning logs? the command above is fixed and we want to find some 
verdict like what exactly happened
while executing the same command (w/ different values/dynamic values in command)



Also ffmpeg is not taking a localhost url for a video resource as the input in 
the command below when run via
php Apache xampp configuration in php:

'ffmpeg -y -i "http://localhost/HlsEncryptionProject/encTestVideo.mp4; -preset 
slow -g 48 -sc_threshold 0 -map 0:0 -map 0:1 -map 0:0 -map 0:1 -map 0:0 -map 
0:1 -s:v:0 1920*1080 -b:v:0 286k -s:v:1 1280*720 -b:v:1 2500k -s:v:2 630*360 
-b:v:2 1000k -c:a copy -var_stream_map "v:0,a:0,name:1080p v:1,a:1,name:720p 
v:2,a:2,name:360p" -master_pl_name "MLSFS002.m3u8" -f hls -hls_time 30 
-hls_key_info_file 
"D:/HlsEncryptionProject/content/videos/MLSFS002/enc.keyinfo" 
-hls_playlist_type vod -hls_list_size 0 -hls_segment_filename