VideoHelp Forum
+ Reply to Thread
Results 1 to 14 of 14
Thread
  1. I've hit a brick-wall trying to resolve this issue, so here I am.

    I have a camera that outputs a HEVC video stream (See image one of what VLC tells me about the stream).

    I want to write this stream directly to an mp4 file.

    This seems like a pretty simple thing, use ffmpeg to copy the streams to the file, done.

    Code:
    ffmpeg -i rtsp://someuser:1111@192.168.0.123:10554/udp/av0_0 -c:v copy -c:a aac output.mp4
    This however results in a file that when played in VLC displays no video. No broken video, just... nothing. The codec info has also been changed. See the second image.

    Now, interestingly, if I output to an AVI file instead, that works AND the buffer dimensions show up correctly. Sadly, AVI is not an option.

    So I guess I'm looking for any help as to why ffmpeg is generating an unplayable file from this stream. I am suspicious of the change in buffer dimensions especially, but not a clue how to fix that.
    Image Attached Images    
    Last edited by Drunlade; 22nd Oct 2021 at 00:50.
    Quote Quote  
  2. Member
    Join Date
    Feb 2006
    Location
    United States
    Search Comp PM
    try your file like this - ffmpeg -i input-hevc output.mp4
    Quote Quote  
  3. If you don't set the directive to copy the stream, it seems that ffmpeg wants to re-encode the stream instead, as seen in the resulting stream mapping:

    Code:
    Stream #0:0 -> #0:0 (hevc (native) -> h264 (libx264))
    Since the video is already a good format that I'd like to keep, re-encoding isn't what I'm after.
    Quote Quote  
  4. Member
    Join Date
    Feb 2006
    Location
    United States
    Search Comp PM
    Originally Posted by Drunlade View Post
    If you don't set the directive to copy the stream, it seems that ffmpeg wants to re-encode the stream instead, as seen in the resulting stream mapping:

    Code:
    Stream #0:0 -> #0:0 (hevc (native) -> h264 (libx264))
    Since the video is already a good format that I'd like to keep, re-encoding isn't what I'm after.
    try this - ffmpeg -i input -c:v libx265 -c:a copy output.mp4
    Quote Quote  
  5. I appreciate the help, but that really doesn't make much sense as a solution. The video is encoded in H265 already. This just decodes the existing H265 and then encodes it into a slightly different variation of H265. This obviously loses video quality in the process, but more importantly uses a lot of processing resources, which simply aren't going to be available.
    Quote Quote  
  6. Member
    Join Date
    Feb 2006
    Location
    United States
    Search Comp PM
    Originally Posted by Drunlade View Post
    I appreciate the help, but that really doesn't make much sense as a solution. The video is encoded in H265 already. This just decodes the existing H265 and then encodes it into a slightly different variation of H265. This obviously loses video quality in the process, but more importantly uses a lot of processing resources, which simply aren't going to be available.
    maybe read "How to generate an MP4 with H.265 codec using FFmpeg" - https://superuser.com/questions/785528/how-to-generate-an-mp4-with-h-265-codec-using-ffmpeg/785532
    Quote Quote  
  7. Did you just "Google that for me"? haha I have indeed spent quite some considerable time looking at stackoverflow, superuser, etc,

    You have the wrong end of the stick though with that particular result, that is once again talking about encoding for MP4 files. I do not wish to encode it, it's already encoded, I just want to stream it to a file that works, and MP4 files support the codec in question.
    Quote Quote  
  8. A simple copy is not an option?
    ffmpeg -i yourfile -c copy output.mp4
    Quote Quote  
  9. Sadly not, if you see the opening comment, I was indeed using a copy - not "simple" I guess, but only because the audio format is unsupported in MP4 files so needed encoding. FFMPEG is doing something to the stream or MP4 headers that's breaking the ability to playback the file.
    Quote Quote  
  10. You could first remux video/convert audio to mp4 and stream the resulting mp4 after.
    Quote Quote  
  11. Member
    Join Date
    Feb 2006
    Location
    United States
    Search Comp PM
    Originally Posted by Drunlade View Post
    Sadly not, if you see the opening comment, I was indeed using a copy - not "simple" I guess, but only because the audio format is unsupported in MP4 files so needed encoding. FFMPEG is doing something to the stream or MP4 headers that's breaking the ability to playback the file.
    might also try ffmpeg.org - https://trac.ffmpeg.org/wiki/Encode/H.265
    Quote Quote  
  12. Try using mkv as your output. If it works, remux to mp4
    Quote Quote  
  13. Originally Posted by blud7 View Post
    Try using mkv as your output. If it works, remux to mp4
    I vote for this approach, One could use mkv (or .ts would be another option) as an intermediate format and directly remux the stream to mp4 while recording. Also, make sure you are using the very latest version of ffmpeg, not the latest release build, see gyandev's homepage for more infos on that.

    It is still possible tough that the final mp4 would still not work, in that case you'd need to check if you can live with another container.

    Example:

    ffmpeg -i rtsp://someuser:1111@192.168.0.123:10554/udp/av0_0 -c:v copy -c:a aac -f matroska - | ffmpeg -i - -codec copy -map 0 C:\temp\my_record.mp4

    With the current information we have, i suspect you found a bug in the ffmpeg mp4 muxer, or better a non supported h265 stream, you could also report that in ffmpeg trac.
    Quote Quote  



Similar Threads

Visit our sponsor! Try DVDFab and backup Blu-rays!